55 const std::string AztecSolver_name =
"Aztec Solver";
57 const std::string AztecPreconditioner_name =
"Aztec Preconditioner";
60 AZTEC_PREC_NONE, AZTEC_PREC_ILU, AZTEC_PREC_ILUT, AZTEC_PREC_JACOBI,
61 AZTEC_PREC_SYMMGS, AZTEC_PREC_POLY, AZTEC_PREC_LSPOLY
72 const std::string Overlap_name =
"Overlap";
74 const std::string GraphFill_name =
"Graph Fill";
76 const std::string DropTolerance_name =
"Drop Tolerance";
78 const std::string FillFactor_name =
"Fill Factor";
80 const std::string Steps_name =
"Steps";
82 const std::string PolynomialOrder_name =
"Polynomial Order";
84 const std::string RCMReordering_name =
"RCM Reordering";
86 const std::string Orthogonalization_name =
"Orthogonalization";
88 const std::string SizeOfKrylovSubspace_name =
"Size of Krylov Subspace";
90 const std::string ConvergenceTest_name =
"Convergence Test";
92 const std::string IllConditioningThreshold_name =
"Ill-Conditioning Threshold";
94 const std::string OutputFrequency_name =
"Output Frequency";
105 using Teuchos::getIntegralValue;
106 using Teuchos::getParameter;
113 solver->SetAztecOption(
115 ,getIntegralValue<int>(*pl,AztecSolver_name)
119 getIntegralValue<EAztecPreconditioner>(
120 *pl,AztecPreconditioner_name
126 case AZTEC_PREC_NONE:
127 solver->SetAztecOption(AZ_precond,AZ_none);
128 pl->
set(AztecPreconditioner_name,
"none");
131 solver->SetAztecOption(AZ_precond,AZ_dom_decomp);
132 solver->SetAztecOption(AZ_overlap,getParameter<int>(*pl,Overlap_name));
133 solver->SetAztecOption(AZ_subdomain_solve,AZ_ilu);
134 solver->SetAztecOption(AZ_graph_fill,getParameter<int>(*pl,GraphFill_name));
135 pl->
set(AztecPreconditioner_name,
"ilu");
137 case AZTEC_PREC_ILUT:
138 solver->SetAztecOption(AZ_precond,AZ_dom_decomp);
139 solver->SetAztecOption(AZ_overlap,getParameter<int>(*pl,Overlap_name));
140 solver->SetAztecOption(AZ_subdomain_solve,AZ_ilut);
141 solver->SetAztecParam(AZ_drop,getParameter<double>(*pl,DropTolerance_name));
142 solver->SetAztecParam(AZ_ilut_fill,getParameter<double>(*pl,FillFactor_name));
143 pl->
set(AztecPreconditioner_name,
"ilut");
145 case AZTEC_PREC_JACOBI:
146 solver->SetAztecOption(AZ_precond,AZ_Jacobi);
147 solver->SetAztecOption(AZ_poly_ord,getParameter<int>(*pl,Steps_name));
148 pl->
set(AztecPreconditioner_name,
"Jacobi");
150 case AZTEC_PREC_SYMMGS:
151 solver->SetAztecOption(AZ_precond,AZ_sym_GS);
152 solver->SetAztecOption(AZ_poly_ord,getParameter<int>(*pl,Steps_name));
153 pl->
set(AztecPreconditioner_name,
"Symmetric Gauss-Seidel");
155 case AZTEC_PREC_POLY:
156 solver->SetAztecOption(AZ_precond,AZ_Neumann);
157 solver->SetAztecOption(AZ_poly_ord,getParameter<int>(*pl,PolynomialOrder_name));
158 pl->
set(AztecPreconditioner_name,
"Polynomial");
160 case AZTEC_PREC_LSPOLY:
161 solver->SetAztecOption(AZ_precond,AZ_ls);
162 solver->SetAztecOption(AZ_poly_ord,getParameter<int>(*pl,PolynomialOrder_name));
163 pl->
set(AztecPreconditioner_name,
"Least-squares Polynomial");
169 solver->SetAztecOption(
171 ,getIntegralValue<int>(*pl,RCMReordering_name)
174 solver->SetAztecOption(
176 ,getIntegralValue<int>(*pl,Orthogonalization_name)
179 solver->SetAztecOption(AZ_kspace,getParameter<int>(*pl,SizeOfKrylovSubspace_name));
181 solver->SetAztecOption(
183 ,getIntegralValue<int>(*pl,ConvergenceTest_name)
186 solver->SetAztecParam(
187 AZ_ill_cond_thresh, getParameter<double>(*pl,IllConditioningThreshold_name)
190 solver->SetAztecOption(
191 AZ_output, getParameter<int>(*pl,OutputFrequency_name)
196 #endif // TEUCHOS_DEBUG
211 using Teuchos::tuple;
212 using Teuchos::setStringToIntegralParameter;
213 using Teuchos::setIntParameter;
214 using Teuchos::setDoubleParameter;
229 RCP<ParameterList> pl = validAztecOOParams;
230 if(pl.get())
return pl;
231 pl = validAztecOOParams =
rcp(
new ParameterList());
233 setStringToIntegralParameter<int>(
234 AztecSolver_name,
"GMRES",
235 "Type of linear solver algorithm to use.",
236 tuple<std::string>(
"CG",
"GMRES",
"CGS",
"TFQMR",
"BiCGStab",
"LU",
"GMRESR",
"FixedPoint"),
237 tuple<int>(AZ_cg,AZ_gmres,AZ_cgs,AZ_tfqmr,AZ_bicgstab,AZ_lu,AZ_GMRESR,AZ_fixed_pt),
240 setStringToIntegralParameter<EAztecPreconditioner>(
241 AztecPreconditioner_name,
"ilu",
242 "Type of internal preconditioner to use.\n"
243 "Note! this preconditioner will only be used if the input operator\n"
244 "supports the Epetra_RowMatrix interface and the client does not pass\n"
245 "in an external preconditioner!",
247 "none",
"ilu",
"ilut",
"Jacobi",
248 "Symmetric Gauss-Seidel",
"Polynomial",
"Least-squares Polynomial"
250 tuple<EAztecPreconditioner>(
251 AZTEC_PREC_NONE,AZTEC_PREC_ILU,AZTEC_PREC_ILUT,AZTEC_PREC_JACOBI,
252 AZTEC_PREC_SYMMGS,AZTEC_PREC_POLY,AZTEC_PREC_LSPOLY
258 "The amount of overlap used for the internal \"ilu\" and \"ilut\" preconditioners.",
263 "The amount of fill allowed for the internal \"ilu\" preconditioner.",
267 DropTolerance_name, 0.0,
268 "The tolerance below which an entry from the factors of an internal \"ilut\"\n"
269 "preconditioner will be dropped.",
273 FillFactor_name, 1.0,
274 "The amount of fill allowed for an internal \"ilut\" preconditioner.",
279 "Number of steps taken for the \"Jacobi\" or the \"Symmetric Gauss-Seidel\"\n"
280 "internal preconditioners for each preconditioner application.",
284 PolynomialOrder_name, 3,
285 "The order for of the polynomials used for the \"Polynomial\" and\n"
286 "\"Least-squares Polynomial\" internal preconditioners.",
289 setStringToIntegralParameter<int>(
290 RCMReordering_name,
"Disabled",
291 "Determines if RCM reordering is used with the internal\n"
292 "\"ilu\" or \"ilut\" preconditioners.",
293 tuple<std::string>(
"Enabled",
"Disabled"),
297 setStringToIntegralParameter<int>(
298 Orthogonalization_name,
"Classical",
299 "The type of orthogonalization to use with the \"GMRES\" solver.",
300 tuple<std::string>(
"Classical",
"Modified"),
301 tuple<int>(AZ_classic,AZ_modified),
305 SizeOfKrylovSubspace_name, 300,
306 "The maximum size of the Krylov subspace used with \"GMRES\" before\n"
307 "a restart is performed.",
310 setStringToIntegralParameter<int>(
311 ConvergenceTest_name,
"r0",
312 "The convergence test to use for terminating the iterative solver.",
313 tuple<std::string>(
"r0",
"rhs",
"Anorm",
"no scaling",
"sol"),
314 tuple<int>(AZ_r0,AZ_rhs,AZ_Anorm,AZ_noscaled,AZ_sol),
318 IllConditioningThreshold_name, 1e+11,
319 "The threshold tolerance above which a system is considered\n"
324 OutputFrequency_name, 0,
325 "The number of iterations between each output of the solver's progress.",
void setAztecOOParameters(Teuchos::ParameterList *pl, AztecOO *solver)
Setup an AztecOO solver object with a set of parameters.
static void addConverter(RCP< const ParameterEntryValidator > validator, RCP< ValidatorXMLConverter > converterToAdd)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
std::istringstream & operator>>(std::istringstream &in, TwoDArray< T > &array)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
Teuchos::RCP< const Teuchos::ParameterList > getValidAztecOOParameters()
Return the list of all valid AztecOO parameters (to validate against).
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)