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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2474 - (show annotations)
Tue Jun 16 06:32:15 2009 UTC (10 years, 5 months ago) by gross
File MIME type: text/plain
File size: 6273 byte(s)
linearPDEs has is now using the SolverOptions class to talk to PASO
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: solver options */
18
19 /**************************************************************/
20
21 /* Copyrights by ACcESS Australia, 2003,2004 */
22 /* author: gross@access.edu.au */
23
24 /**************************************************************/
25
26 #include "Paso.h"
27 #include "Options.h"
28
29 /**************************************************************/
30
31 /* set the default values for solver options */
32
33 void Paso_Options_setDefaults(Paso_Options* options) {
34 options->verbose=FALSE;
35 options->method=PASO_DEFAULT;
36 options->package=PASO_DEFAULT;
37 options->symmetric=FALSE;
38 options->reordering=PASO_NO_REORDERING;
39 options->tolerance=1.E-8;
40 options->absolute_tolerance=0.;
41 options->inner_tolerance=0.9;
42 options->adapt_inner_tolerance=TRUE;
43 options->preconditioner=PASO_JACOBI;
44 options->iter_max=10000;
45 options->inner_iter_max=10;
46 options->drop_tolerance=0.01;
47 options->drop_storage=2.;
48 options->restart=-1;
49 options->truncation=20;
50 options->sweeps=2;
51 options->pre_sweeps=2;
52 options->post_sweeps=2;
53 options->coarsening_threshold=0.05;
54 options->level_max=300;
55 options->accept_failed_convergence=FALSE;
56 options->coarsening_method=PASO_DEFAULT;
57 options->relaxation_factor=0.95;
58
59 /* diagnostic values */
60 options->num_iter=-1;
61 options->num_level=-1;
62 options->num_inner_iter=-1;
63 options->time=-1.;
64 options->set_up_time=-1.;
65 options->residual_norm=-1.;
66 options->converged=FALSE;
67 }
68 void Paso_Options_showDiagnostics(const Paso_Options* options) {
69 printf("Paso diagonsitics:\n");
70 printf("\tnum_iter = %d\n",options->num_iter);
71 printf("\tnum_level = %d\n",options->num_level);
72 printf("\tnum_inner_iter = %d\n",options->num_inner_iter);
73 printf("\ttime = %e\n",options->time);
74 printf("\tset_up_time = %e\n",options->set_up_time);
75 printf("\tresidual_norm = %e\n",options->residual_norm);
76 printf("\tconverged = %d\n",options->converged);
77 }
78 const char* Paso_Options_name(const index_t key){
79 switch (key) {
80 case PASO_DEFAULT:
81 return "DEFAULT";
82 case PASO_DIRECT:
83 return "DIRECT";
84 case PASO_CHOLEVSKY:
85 return "CHOLEVSKY";
86 case PASO_PCG:
87 return "PCG";
88 case PASO_CR:
89 return "CR";
90 case PASO_CGS:
91 return "CGS";
92 case PASO_BICGSTAB:
93 return "BICGSTAB";
94 case PASO_SSOR:
95 return "SSOR";
96 case PASO_ILU0:
97 return "ILU0";
98 case PASO_ILUT:
99 return "ILUT";
100 case PASO_JACOBI:
101 return "JACOBI";
102 case PASO_GMRES:
103 return "GMRES";
104 case PASO_PRES20:
105 return "PRES20";
106 case PASO_LUMPING:
107 return "LUMPING";
108 case PASO_NO_REORDERING:
109 return "NO_REORDERING";
110 case PASO_MINIMUM_FILL_IN:
111 return "MINIMUM_FILL_IN";
112 case PASO_NESTED_DISSECTION:
113 return "NESTED_DISSECTION";
114 case PASO_MKL:
115 return "MKL";
116 case PASO_UMFPACK:
117 return "UMFPACK";
118 case PASO_ITERATIVE:
119 return "ITERATIVE";
120 case PASO_PASO:
121 return "PASO";
122 case PASO_AMG:
123 return "AMG";
124 case PASO_REC_ILU:
125 return "REC_ILU";
126 case PASO_TRILINOS:
127 return "TRILINOS";
128 case PASO_NONLINEAR_GMRES:
129 return "NONLINEAR_GMRES";
130 case PASO_TFQMR :
131 return "TFQMR";
132 case PASO_MINRES:
133 return "MINRES";
134 case PASO_GAUSS_SEIDEL:
135 return "GAUSS_SEIDEL";
136 case PASO_RILU:
137 return "RILU";
138 case PASO_DEFAULT_REORDERING:
139 return "DEFAULT_REORDERING";
140 case PASO_SUPER_LU:
141 return "SUPER_LU";
142 case PASO_PASTIX:
143 return "PASTIX";
144 case PASO_YAIR_SHAPIRA_COARSENING:
145 return "YAIR_SHAPIRA_COARSENING";
146 case PASO_RUGE_STUEBEN_COARSENING:
147 return "RUGE_STUEBEN_COARSENING";
148 case PASO_AGGREGATION_COARSENING:
149 return "AGGREGATION_COARSENING";
150 case PASO_NO_PRECONDITIONER:
151 return "NO_PRECONDITIONER";
152 default:
153 return "<unknown>";
154 }
155 }
156 void Paso_Options_show(const Paso_Options* options ) {
157 printf("Paso options settings:\n");
158 printf("\tverbose = %d\n",options->verbose);
159 printf("\tmethod = %s (%d)\n",Paso_Options_name(options->method),options->method);
160 printf("\tpackage = %s (%d)\n",Paso_Options_name(options->package),options->package);
161 printf("\tsymmetric = %d\n",options->symmetric);
162 printf("\treordering = %s (%d)\n",Paso_Options_name(options->reordering),options->reordering);
163 printf("\ttolerance = %e\n",options->tolerance);
164 printf("\tabsolute_tolerance = %e\n",options->absolute_tolerance);
165 printf("\tinner_tolerance = %e\n",options->inner_tolerance);
166 printf("\tadapt_inner_tolerance = %d\n",options->adapt_inner_tolerance);
167 printf("\tpreconditioner = %s (%d)\n",Paso_Options_name(options->preconditioner),options->preconditioner);
168 printf("\titer_max = %d\n",options->iter_max);
169 printf("\tinner_iter_max = %d\n",options->inner_iter_max);
170 printf("\tdrop_tolerance = %e\n",options->drop_tolerance);
171 printf("\tdrop_storage = %e\n",options->drop_storage);
172 printf("\trestart = %d\n",options->restart);
173 printf("\ttruncation = %d\n",options->truncation);
174 printf("\tsweeps = %d\n",options->sweeps);
175 printf("\tpre_sweeps = %d\n",options->pre_sweeps);
176 printf("\tpost_sweeps = %d\n",options->post_sweeps);
177 printf("\tcoarsening_threshold = %e\n",options->coarsening_threshold);
178 printf("\tlevel_max = %d\n",options->level_max);
179 printf("\taccept_failed_convergence = %d\n",options->accept_failed_convergence);
180 printf("\tcoarsening_method = %s (%d)\n",Paso_Options_name(options->coarsening_method), options->coarsening_method);
181 printf("\trelaxation_factor = %e\n",options->relaxation_factor);
182 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26