/[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 411 - (show annotations)
Tue Jan 3 00:23:48 2006 UTC (13 years, 8 months ago) by gross
File MIME type: text/plain
File size: 3917 byte(s)
SCSL interface has moved

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

  ViewVC Help
Powered by ViewVC 1.1.26