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

  ViewVC Help
Powered by ViewVC 1.1.26