/[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 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years, 1 month ago) by ksteube
File MIME type: text/plain
File size: 4428 byte(s)
Copyright updated in all files

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

  ViewVC Help
Powered by ViewVC 1.1.26