/[escript]/trunk/esys2/finley/src/finleyC/SCSL/SCSL_iterative.c
ViewVC logotype

Contents of /trunk/esys2/finley/src/finleyC/SCSL/SCSL_iterative.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 100 - (show annotations)
Wed Dec 15 03:48:48 2004 UTC (14 years, 11 months ago) by jgs
File MIME type: text/plain
File size: 3427 byte(s)
*** empty log message ***

1 /* $Id$ */
2
3 /**************************************************************/
4
5 /* Finley: SystemMatrix: interface to SGI SCSL iterative solver */
6
7 /**************************************************************/
8
9 /* Copyrights by ACcESS Australia 2003/04 */
10 /* Author: gross@access.edu.au */
11
12 /**************************************************************/
13
14 #include "Finley.h"
15 #include "System.h"
16 #if ITERATIVE_SOLVER == SGI_SCSL
17 #include <scsl_sparse.h>
18 #include "SCSL.h"
19 #endif
20
21 /***********************************************************************************/
22
23 /* free any extra stuff possibly used by the SCSL library */
24
25 void Finley_SCSL_iterative_free(Finley_SystemMatrix* A) {
26
27 }
28
29 /* call the iterative solver: */
30
31 void Finley_SCSL_iterative(Finley_SystemMatrix* A,
32 double* out,double* in,Finley_SolverOptions* options) {
33 #if ITERATIVE_SOLVER == SGI_SCSL
34 char text2[3];
35 int iters, method,precond,storage,maxiters;
36 double drop_tolerance,drop_storage,finalres,convtol,time0;
37 if (A->col_block_size!=1) {
38 Finley_ErrorCode=TYPE_ERROR;
39 sprintf(Finley_ErrorMsg,"SCSL linear solver can only be applied to block size 1.");
40 return;
41 }
42 #ifdef Finley_TRACE
43 printf("solver is SCSL\n");
44 #endif
45
46 switch(A->type) {
47 case CSR:
48 storage=0;
49 break;
50 case CSC:
51 storage=1;
52 break;
53 default:
54 Finley_ErrorCode=TYPE_ERROR;
55 sprintf(Finley_ErrorMsg,"Unknown matrix type.");
56 return;
57 } /* switch A->type */
58
59 if (A->symmetric) {
60 switch (options->iterative_method) {
61 case PCG:
62 method=0;
63 break;
64 case CR:
65 method=1;
66 break;
67 default:
68 method=0;
69 break;
70 }
71 } else {
72 switch (options->iterative_method) {
73 case CGS:
74 method=10;
75 break;
76 case BICGSTAB:
77 method=11;
78 break;
79 default:
80 method=11;
81 break;
82 }
83 }
84 switch (options->preconditioner) {
85 case JACOBI:
86 precond=0;
87 break;
88 case SSOR:
89 precond=1;
90 break;
91 case ILU0:
92 if (A->symmetric) precond = 2;
93 else precond=0;
94 break;
95 case ILUT:
96 if (A->symmetric) precond = 3;
97 else precond=0;
98 break;
99 default:
100 precond=0;
101 break;
102 }
103 maxiters=options->iter_max;
104 convtol=options->tolerance;
105
106 drop_tolerance=options->drop_tolerance;
107 DIterative_DropTol(drop_tolerance);
108 drop_storage=options->drop_storage;
109 DIterative_DropStorage(drop_storage);
110
111 if (options->verbose) {
112 setenv("ITERATIVE_VERBOSE","1",1);
113 } else {
114 unsetenv("ITERATIVE_VERBOSE");
115 }
116 if (options->reordering==NO_REORDERING) {
117 sprintf(text2,"%d",0);
118 } else {
119 sprintf(text2,"%d",-1);
120 }
121 setenv("ITERATIVE_RCM",text2,1);
122 setenv("ITERATIVE_COPY","1",1);
123
124 time0=Finley_timer();
125 DIterative(A->num_rows,A->ptr,A->index,A->val,storage,out,in,method,precond,maxiters,convtol,&iters,&finalres);
126 options->iter=iters;
127 options->final_residual=finalres;
128 time0=Finley_timer()-time0;
129 printf("timing SCSL: solve: %.4e sec\n",time0);
130 if (iters>0) printf("timing: per iteration: %.4e sec\n",time0/iters);
131 #endif
132 }
133 /*
134 * $Log$
135 * Revision 1.3 2004/12/15 03:48:47 jgs
136 * *** empty log message ***
137 *
138 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
139 * initial import of project esys2
140 *
141 * Revision 1.1 2004/07/02 04:21:14 gross
142 * Finley C code has been included
143 *
144 *
145 */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26