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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 633 - (show annotations)
Thu Mar 23 05:37:00 2006 UTC (13 years, 5 months ago) by dhawcroft
File MIME type: text/plain
File size: 4685 byte(s)


1 /* $Id: SCSL_iterative.c 150 2005-09-15 03:44:45Z jgs $ */
2
3 /*
4 ********************************************************************************
5 * Copyright 2006 by ACcESS MNRF *
6 * *
7 * http://www.access.edu.au *
8 * Primary Business: Queensland, Australia *
9 * Licensed under the Open Software License version 3.0 *
10 * http://www.opensource.org/licenses/osl-3.0.php *
11 ********************************************************************************
12 */
13
14 /**************************************************************/
15
16 /* Paso: SystemMatrix: interface to SGI SCSL iterative solver */
17
18 /**************************************************************/
19
20 /* Copyrights by ACcESS Australia 2003,2004,2005 */
21 /* Author: gross@access.edu.au */
22
23 /**************************************************************/
24
25 #include <stdlib.h>
26 #include "Paso.h"
27 #include "SystemMatrix.h"
28 #include "SCSL.h"
29 #ifdef SCSL
30 #include <scsl_sparse.h>
31 #endif
32
33 /***********************************************************************************/
34
35 /* free any extra stuff possibly used by the SCSL library */
36
37 void Paso_SCSL_iterative_free(Paso_SystemMatrix* A) {
38
39 }
40
41 /* call the iterative solver: */
42
43 void Paso_SCSL_iterative(Paso_SystemMatrix* A,
44 double* out,double* in,Paso_Options* options,Paso_Performance* pp) {
45 #ifdef SCSL
46 char text2[3];
47 int iters, method,precond,storage,maxiters;
48 double drop_tolerance,drop_storage,finalres,convtol,time0;
49 if (A->col_block_size!=1) {
50 Paso_setError(TYPE_ERROR,"Paso_SCSL_direct: linear solver can only be applied to block size 1.");
51 }
52 if (A->type & MATRIX_FORMAT_CSC) {
53 storage=1;
54 if (! (A->type & (MATRIX_FORMAT_CSC + MATRIX_FORMAT_BLK1)) )
55 Paso_setError(TYPE_ERROR,"Paso_SCSL_iterative: iterative solver in compressed sparse column requires a nonsymmetric storage scheme, block size 1 and index offset 0.");
56 } else {
57 storage=0;
58 if (! (A->type & MATRIX_FORMAT_BLK1) )
59 Paso_setError(TYPE_ERROR,"Paso_SCSL_iterative: iterative solver in compressed sparse row requires a nonsymmetric storage scheme, block size 1 and index offset 0.");
60 }
61 Performance_startMonitor(pp,PERFORMANCE_ALL);
62 method=Paso_Options_getSolver(options->method,PASO_PASO,options->symmetric);
63 if (Paso_noError()) {
64 switch (method) {
65 case PASO_PCG:
66 method=0;
67 break;
68 case PASO_CR:
69 method=1;
70 break;
71 case PASO_CGS:
72 method=10;
73 break;
74 case PASO_BICGSTAB:
75 method=11;
76 break;
77 default:
78 method=11;
79 break;
80 }
81 switch (options->preconditioner) {
82 case PASO_JACOBI:
83 precond=0;
84 break;
85 case PASO_SSOR:
86 precond=1;
87 break;
88 case PASO_ILU0:
89 if (options->symmetric) precond = 2;
90 else precond=0;
91 break;
92 case PASO_ILUT:
93 if (options->symmetric) precond = 3;
94 else precond=0;
95 break;
96 default:
97 precond=0;
98 break;
99 }
100 maxiters=options->iter_max;
101 convtol=options->tolerance;
102
103 drop_tolerance=options->drop_tolerance;
104 DIterative_DropTol(drop_tolerance);
105 drop_storage=options->drop_storage;
106 DIterative_DropStorage(drop_storage);
107 time0=Paso_timer();
108 DIterative(A->num_rows,A->pattern->ptr,A->pattern->index,A->val,storage,out,in,method,precond,maxiters,convtol,&iters,&finalres);
109 options->iter=iters;
110 options->final_residual=finalres;
111 time0=Paso_timer()-time0;
112 if (options->verbose) {
113 printf("timing SCSL: solve: %.4e sec\n",time0);
114 if (iters>0) printf("timing: per iteration: %.4e sec\n",time0/iters);
115 }
116 }
117 Performance_stopMonitor(pp,PERFORMANCE_ALL);
118 #else
119 Paso_setError(SYSTEM_ERROR,"Paso_SCSL_iterative: SCSL not available.");
120 #endif
121 }
122
123 /*
124 * $Log$
125 * Revision 1.2 2005/09/15 03:44:40 jgs
126 * Merge of development branch dev-02 back to main trunk on 2005-09-15
127 *
128 * Revision 1.1.2.2 2005/09/07 00:59:08 gross
129 * some inconsistent renaming fixed to make the linking work.
130 *
131 * Revision 1.1.2.1 2005/09/05 06:29:49 gross
132 * These files have been extracted from finley to define a stand alone libray for iterative
133 * linear solvers on the ALTIX. main entry through Paso_solve. this version compiles but
134 * has not been tested yet.
135 *
136 *
137 */

  ViewVC Help
Powered by ViewVC 1.1.26