MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_ML2MueLuParameterTranslator.cpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#include "MueLu_ConfigDefs.hpp"
11
13using Teuchos::ParameterList;
14
15namespace MueLu {
16
17std::string ML2MueLuParameterTranslator::GetSmootherFactory(const Teuchos::ParameterList &paramList, Teuchos::ParameterList &adaptingParamList, const std::string &pname, const std::string &value) {
18 TEUCHOS_TEST_FOR_EXCEPTION(pname != "coarse: type" && pname != "coarse: list" && pname != "smoother: type" && pname.find("smoother: list", 0) != 0,
20 "MueLu::MLParameterListInterpreter::Setup(): Only \"coarse: type\", \"smoother: type\" or \"smoother: list\" (\"coarse: list\") are "
21 "supported as ML parameters for transformation of smoother/solver parameters to MueLu");
22
23 // string stream containing the smoother/solver xml parameters
24 std::stringstream mueluss;
25
26 // Check whether we are dealing with coarse level (solver) parameters or level smoother parameters
27 std::string mode = "smoother:";
28 bool is_coarse = false;
29 if (pname.find("coarse:", 0) == 0) {
30 mode = "coarse:";
31 is_coarse = true;
32 }
33
34 // check whether pre and/or post smoothing
35 std::string PreOrPost = "both";
36 if (paramList.isParameter(mode + " pre or post"))
37 PreOrPost = paramList.get<std::string>(mode + " pre or post");
38
39 TEUCHOS_TEST_FOR_EXCEPTION(mode == "coarse:" && PreOrPost != "both", Exceptions::RuntimeError,
40 "MueLu::MLParameterListInterpreter::Setup(): The parameter \"coarse: pre or post\" is not supported by MueLu. "
41 "It does not make sense for direct solvers. For iterative solvers you obtain the same effect by increasing, "
42 "e.g., the number of sweeps for the coarse grid smoother. Please remove it from your parameters.");
43
44 // select smoother type
45 std::string valuestr = value; // temporary variable
46 std::transform(valuestr.begin(), valuestr.end(), valuestr.begin(), ::tolower);
47 if (valuestr == "jacobi" || valuestr == "gauss-seidel" || valuestr == "symmetric gauss-seidel") {
48 std::string my_name;
49 if (PreOrPost == "both")
50 my_name = "\"" + pname + "\"";
51 else
52 my_name = "\"smoother: " + PreOrPost + " type\"";
53 mueluss << "<Parameter name=" << my_name << " type=\"string\" value=\"RELAXATION\"/>" << std::endl;
54
55 } else if (valuestr == "hiptmair") {
56 std::string my_name;
57 if (PreOrPost == "both")
58 my_name = "\"" + pname + "\"";
59 else
60 my_name = "\"smoother: " + PreOrPost + " type\"";
61 mueluss << "<Parameter name=" << my_name << " type=\"string\" value=\"HIPTMAIR\"/>" << std::endl;
62
63 } else if (valuestr == "ifpack") {
64 std::string my_name = "\"" + pname + "\"";
65 if (paramList.isParameter("smoother: ifpack type")) {
66 if (paramList.get<std::string>("smoother: ifpack type") == "ILU") {
67 mueluss << "<Parameter name=" << my_name << " type=\"string\" value=\"ILU\"/>" << std::endl;
68 adaptingParamList.remove("smoother: ifpack type", false);
69 }
70 if (paramList.get<std::string>("smoother: ifpack type") == "ILUT") {
71 mueluss << "<Parameter name=" << my_name << " type\" type=\"string\" value=\"ILUT\"/>" << std::endl;
72 adaptingParamList.remove("smoother: ifpack type", false);
73 }
74 }
75
76 } else if ((valuestr == "chebyshev") || (valuestr == "mls")) {
77 std::string my_name = "\"" + pname + "\"";
78 mueluss << "<Parameter name=" << my_name << " type=\"string\" value=\"CHEBYSHEV\"/>" << std::endl;
79
80 } else if (valuestr.length() > strlen("amesos") && valuestr.substr(0, strlen("amesos")) == "amesos") { /* catch Amesos-* */
81 std::string solverType = valuestr.substr(strlen("amesos") + 1); /* ("amesos-klu" -> "klu") */
82
83 bool valid = false;
84 const int validatorSize = 5;
85 std::string validator[validatorSize] = {"superlu", "superludist", "klu", "umfpack", "mumps"};
86 for (int i = 0; i < validatorSize; i++)
87 if (validator[i] == solverType)
88 valid = true;
89 TEUCHOS_TEST_FOR_EXCEPTION(!valid, Exceptions::RuntimeError,
90 "MueLu::MLParameterListInterpreter: unknown smoother type. '" << solverType << "' not supported.");
91
92 mueluss << "<Parameter name=\"" << pname << "\" type=\"string\" value=\"" << solverType << "\"/>" << std::endl;
93 } else {
94 // TODO error message
95 std::cout << "error in " << __FILE__ << ":" << __LINE__ << " could not find valid smoother/solver: " << valuestr << std::endl;
96 }
97
98 // set smoother: pre or post parameter
99 // Note that there is no "coarse: pre or post" in MueLu!
100 if (paramList.isParameter("smoother: pre or post") && mode == "smoother:") {
101 // std::cout << "paramList" << paramList << std::endl;
102 // std::string smootherPreOrPost = paramList.get<std::string>("smoother: pre or post");
103 // std::cout << "Create pre or post parameter with " << smootherPreOrPost << std::endl;
104 mueluss << "<Parameter name=\"smoother: pre or post\" type=\"string\" value=\"" << PreOrPost << "\"/>" << std::endl;
105 adaptingParamList.remove("smoother: pre or post", false);
106 }
107
108 // create smoother parameter list
109 if (PreOrPost != "both") {
110 mueluss << "<ParameterList name=\"smoother: " << PreOrPost << " params\">" << std::endl;
111 } else {
112 mueluss << "<ParameterList name=\"" << mode << " params\">" << std::endl;
113 }
114
115 // relaxation based smoothers:
116
117 if (valuestr == "jacobi" || valuestr == "gauss-seidel" || valuestr == "symmetric gauss-seidel") {
118 if (valuestr == "jacobi") {
119 mueluss << "<Parameter name=\"relaxation: type\" type=\"string\" value=\"Jacobi\"/>" << std::endl;
120 adaptingParamList.remove("relaxation: type", false);
121 }
122 if (valuestr == "gauss-seidel") {
123 mueluss << "<Parameter name=\"relaxation: type\" type=\"string\" value=\"Gauss-Seidel\"/>" << std::endl;
124 adaptingParamList.remove("relaxation: type", false);
125 }
126 if (valuestr == "symmetric gauss-seidel") {
127 mueluss << "<Parameter name=\"relaxation: type\" type=\"string\" value=\"Symmetric Gauss-Seidel\"/>" << std::endl;
128 adaptingParamList.remove("relaxation: type", false);
129 }
130 if (paramList.isParameter("smoother: sweeps")) {
131 mueluss << "<Parameter name=\"relaxation: sweeps\" type=\"int\" value=\"" << paramList.get<int>("smoother: sweeps") << "\"/>" << std::endl;
132 adaptingParamList.remove("smoother: sweeps", false);
133 }
134 if (paramList.isParameter("smoother: damping factor")) {
135 mueluss << "<Parameter name=\"relaxation: damping factor\" type=\"double\" value=\"" << paramList.get<double>("smoother: damping factor") << "\"/>" << std::endl;
136 adaptingParamList.remove("smoother: damping factor", false);
137 }
138 if (paramList.isParameter("smoother: use l1 Gauss-Seidel")) {
139 mueluss << "<Parameter name=\"relaxation: use l1\" type=\"bool\" value=\"" << paramList.get<bool>("smoother: use l1 Gauss-Seidel") << "\"/>" << std::endl;
140 adaptingParamList.remove("smoother: use l1 Gauss-Seidel", false);
141 }
142 }
143
144 // Chebyshev
145 if (valuestr == "chebyshev") {
146 if (paramList.isParameter("smoother: polynomial order")) {
147 mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<int>("smoother: polynomial order") << "\"/>" << std::endl;
148 adaptingParamList.remove("smoother: polynomial order", false);
149 } else {
150 mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"2\"/>" << std::endl;
151 }
152 if (paramList.isParameter("smoother: Chebyshev alpha")) {
153 mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<double>("smoother: Chebyshev alpha") << "\"/>" << std::endl;
154 adaptingParamList.remove("smoother: Chebyshev alpha", false);
155 } else {
156 mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"20\"/>" << std::endl;
157 adaptingParamList.remove("smoother: Chebyshev alpha", false);
158 }
159 if (paramList.isParameter("eigen-analysis: type")) {
160 mueluss << "<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"" << paramList.get<std::string>("eigen-analysis: type") << "\"/>" << std::endl;
161 adaptingParamList.remove("eigen-analysis: type", false);
162 } else {
163 mueluss << "<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"cg\"/>" << std::endl;
164 }
165 }
166
167 // MLS
168 if (valuestr == "mls") {
169 if (paramList.isParameter("smoother: MLS polynomial order")) {
170 mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<int>("smoother: MLS polynomial order") << "\"/>" << std::endl;
171 adaptingParamList.remove("smoother: MLS polynomial order", false);
172 } else if (paramList.isParameter("smoother: polynomial order")) {
173 mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<int>("smoother: polynomial order") << "\"/>" << std::endl;
174 adaptingParamList.remove("smoother: polynomial order", false);
175 } else {
176 mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"2\"/>" << std::endl;
177 }
178 if (paramList.isParameter("smoother: MLS alpha")) {
179 mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<double>("smoother: MLS alpha") << "\"/>" << std::endl;
180 adaptingParamList.remove("smoother: MLS alpha", false);
181 } else if (paramList.isParameter("smoother: Chebyshev alpha")) {
182 mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<double>("smoother: Chebyshev alpha") << "\"/>" << std::endl;
183 adaptingParamList.remove("smoother: Chebyshev alpha", false);
184 } else {
185 mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"20\"/>" << std::endl;
186 }
187 if (paramList.isParameter("eigen-analysis: type")) {
188 mueluss << "<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"" << paramList.get<std::string>("eigen-analysis: type") << "\"/>" << std::endl;
189 adaptingParamList.remove("eigen-analysis: type", false);
190 } else {
191 mueluss << "<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"cg\"/>" << std::endl;
192 }
193 }
194
195 if (valuestr == "hiptmair") {
196 std::string subSmootherType = "Chebyshev";
197 if (!is_coarse && paramList.isParameter("subsmoother: type"))
198 subSmootherType = paramList.get<std::string>("subsmoother: type");
199 if (is_coarse && paramList.isParameter("smoother: subsmoother type"))
200 subSmootherType = paramList.get<std::string>("smoother: subsmoother type");
201
202 std::string subSmootherIfpackType;
203
204 if (subSmootherType == "Chebyshev")
205 subSmootherIfpackType = "CHEBYSHEV";
206 else if (subSmootherType == "Jacobi" || subSmootherType == "Gauss-Seidel" || subSmootherType == "symmetric Gauss-Seidel") {
207 if (subSmootherType == "symmetric Gauss-Seidel") subSmootherType = "Symmetric Gauss-Seidel"; // FIXME
208 subSmootherIfpackType = "RELAXATION";
209 } else
210 TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "MueLu::MLParameterListTranslator: unknown smoother type. '" << subSmootherType << "' not supported by MueLu.");
211
212 mueluss << "<Parameter name=\"hiptmair: smoother type 1\" type=\"string\" value=\"" << subSmootherIfpackType << "\"/>" << std::endl;
213 mueluss << "<Parameter name=\"hiptmair: smoother type 2\" type=\"string\" value=\"" << subSmootherIfpackType << "\"/>" << std::endl;
214
215 mueluss << "<ParameterList name=\"hiptmair: smoother list 1\">" << std::endl;
216 if (subSmootherType == "Chebyshev") {
217 std::string edge_sweeps = is_coarse ? "smoother: edge sweeps" : "subsmoother: edge sweeps";
218 std::string cheby_alpha = is_coarse ? "smoother: Chebyshev alpha" : "subsmoother: Chebyshev_alpha";
219
220 if (paramList.isParameter(edge_sweeps)) {
221 mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<int>(edge_sweeps) << "\"/>" << std::endl;
222 adaptingParamList.remove("subsmoother: edge sweeps", false);
223 }
224 if (paramList.isParameter(cheby_alpha)) {
225 mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<double>(cheby_alpha) << "\"/>" << std::endl;
226 }
227 } else {
228 std::string edge_sweeps = is_coarse ? "smoother: edge sweeps" : "subsmoother: edge sweeps";
229 std::string SGS_damping = is_coarse ? "smoother: SGS damping factor" : "subsmoother: SGS damping factor";
230
231 if (paramList.isParameter(edge_sweeps)) {
232 mueluss << "<Parameter name=\"relaxation: type\" type=\"string\" value=\"" << subSmootherType << "\"/>" << std::endl;
233 mueluss << "<Parameter name=\"relaxation: sweeps\" type=\"int\" value=\"" << paramList.get<int>(edge_sweeps) << "\"/>" << std::endl;
234 adaptingParamList.remove(edge_sweeps, false);
235 }
236 if (paramList.isParameter(SGS_damping)) {
237 mueluss << "<Parameter name=\"relaxation: damping factor\" type=\"double\" value=\"" << paramList.get<double>(SGS_damping) << "\"/>" << std::endl;
238 }
239 }
240 mueluss << "</ParameterList>" << std::endl;
241
242 mueluss << "<ParameterList name=\"hiptmair: smoother list 2\">" << std::endl;
243 if (subSmootherType == "Chebyshev") {
244 std::string node_sweeps = is_coarse ? "smoother: node sweeps" : "subsmoother: node sweeps";
245 std::string cheby_alpha = is_coarse ? "smoother: Chebyshev alpha" : "subsmoother: Chebyshev_alpha";
246 if (paramList.isParameter(node_sweeps)) {
247 mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<int>(node_sweeps) << "\"/>" << std::endl;
248 adaptingParamList.remove("subsmoother: node sweeps", false);
249 }
250 if (paramList.isParameter(cheby_alpha)) {
251 mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<double>(cheby_alpha) << "\"/>" << std::endl;
252 adaptingParamList.remove("subsmoother: Chebyshev alpha", false);
253 }
254 } else {
255 std::string node_sweeps = is_coarse ? "smoother: node sweeps" : "subsmoother: node sweeps";
256 std::string SGS_damping = is_coarse ? "smoother: SGS damping factor" : "subsmoother: SGS damping factor";
257
258 if (paramList.isParameter(node_sweeps)) {
259 mueluss << "<Parameter name=\"relaxation: type\" type=\"string\" value=\"" << subSmootherType << "\"/>" << std::endl;
260 mueluss << "<Parameter name=\"relaxation: sweeps\" type=\"int\" value=\"" << paramList.get<int>(node_sweeps) << "\"/>" << std::endl;
261 adaptingParamList.remove("subsmoother: node sweeps", false);
262 }
263 if (paramList.isParameter(SGS_damping)) {
264 mueluss << "<Parameter name=\"relaxation: damping factor\" type=\"double\" value=\"" << paramList.get<double>(SGS_damping) << "\"/>" << std::endl;
265 adaptingParamList.remove("subsmoother: SGS damping factor", false);
266 }
267 }
268 mueluss << "</ParameterList>" << std::endl;
269 }
270
271 // parameters for ILU based preconditioners
272 if (valuestr == "ifpack") {
273 // add Ifpack parameters
274 if (paramList.isParameter("smoother: ifpack overlap")) {
275 mueluss << "<Parameter name=\"partitioner: overlap\" type=\"int\" value=\"" << paramList.get<int>("smoother: ifpack overlap") << "\"/>" << std::endl;
276 adaptingParamList.remove("smoother: ifpack overlap", false);
277 }
278 if (paramList.isParameter("smoother: ifpack level-of-fill")) {
279 mueluss << "<Parameter name=\"fact: level-of-fill\" type=\"int\" value=\"" << paramList.get<int>("smoother: ifpack level-of-fill") << "\"/>" << std::endl;
280 adaptingParamList.remove("smoother: ifpack level-of-fill", false);
281 }
282 if (paramList.isParameter("smoother: ifpack absolute threshold")) {
283 mueluss << "<Parameter name=\"fact: absolute threshold\" type=\"int\" value=\"" << paramList.get<double>("smoother: ifpack absolute threshold") << "\"/>" << std::endl;
284 adaptingParamList.remove("smoother: ifpack absolute threshold", false);
285 }
286 if (paramList.isParameter("smoother: ifpack relative threshold")) {
287 mueluss << "<Parameter name=\"fact: relative threshold\" type=\"int\" value=\"" << paramList.get<double>("smoother: ifpack relative threshold") << "\"/>" << std::endl;
288 adaptingParamList.remove("smoother: ifpack relative threshold", false);
289 }
290 }
291
292 mueluss << "</ParameterList>" << std::endl;
293
294 // max coarse level size parameter (outside of smoother parameter lists)
295 if (paramList.isParameter("smoother: max size")) {
296 mueluss << "<Parameter name=\"coarse: max size\" type=\"int\" value=\"" << paramList.get<int>("smoother: max size") << "\"/>" << std::endl;
297 adaptingParamList.remove("smoother: max size", false);
298 }
299
300 return mueluss.str();
301}
302
303std::string ML2MueLuParameterTranslator::SetParameterList(const Teuchos::ParameterList &paramList_in, const std::string &defaultVals) {
304 Teuchos::ParameterList paramList = paramList_in;
305
306 RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); // TODO: use internal out (GetOStream())
307 // ML counts levels slightly differently than MueLu does so "repartition: start level" is off by one
308 // ML defaults to "1" if we don't ask for anything else and that needs to map to "2"
309 if (paramList.isParameter("repartition: start level")) {
310 paramList.set("repartition: start level", paramList.get<int>("repartition: start level") + 1);
311 } else {
312 paramList.set("repartition: start level", 2);
313 }
314
315 // ML sets this to 5000
316 if (!paramList.isParameter("repartition: put on single proc")) {
317 paramList.set("repartition: put on single proc", 5000);
318 }
319
320 // Set the default values
321 if (defaultVals != "") {
322 TEUCHOS_TEST_FOR_EXCEPTION(defaultVals != "SA" && defaultVals != "NSSA" && defaultVals != "refmaxwell" && defaultVals != "Maxwell", Exceptions::RuntimeError,
323 "MueLu::ML2MueLuParameterTranslator: only \"SA\", \"NSSA\", \"refmaxwell\" and \"Maxwell\" allowed as options for ML default parameters.");
324 Teuchos::ParameterList ML_defaultlist;
325 if (defaultVals == "refmaxwell")
326 SetDefaultsRefMaxwell(ML_defaultlist);
327 else
328 SetDefaults(defaultVals, ML_defaultlist);
329
330 // merge user parameters with default parameters
331 MueLu::MergeParameterList(paramList_in, ML_defaultlist, true);
332 paramList = ML_defaultlist;
333 }
334
335 //
336 // Move smoothers/aggregation/coarse parameters to sublists
337 //
338
339 // ML allows to have level-specific smoothers/aggregation/coarse parameters at the top level of the list or/and defined in sublists:
340 // See also: ML Guide section 6.4.1, MueLu::CreateSublists, ML_CreateSublists
341 ParameterList paramListWithSubList;
342 MueLu::CreateSublists(paramList, paramListWithSubList);
343 paramList = paramListWithSubList; // swap
344 Teuchos::ParameterList adaptingParamList = paramList; // copy of paramList which is used to removed already interpreted parameters
345
346 {
347 // Special handling of ML's aux aggregation
348 //
349 // In ML, when "aggregation: aux: enable" == true, the threshold
350 // is set via "aggregation: aux: threshold" instead of
351 // "aggregation: threshold". In MueLu, we use "aggregation: drop
352 // tol" regardless of "sa: use filtering". So depending on
353 // "aggregation: aux: enable" we use either one or the other
354 // threshold to set "aggregation: drop tol".
355 if (paramListWithSubList.isParameter("aggregation: aux: enable") && paramListWithSubList.get<bool>("aggregation: aux: enable")) {
356 if (paramListWithSubList.isParameter("aggregation: aux: threshold")) {
357 paramListWithSubList.set("aggregation: threshold", paramListWithSubList.get<double>("aggregation: aux: threshold"));
358 paramListWithSubList.remove("aggregation: aux: threshold");
359 }
360 }
361 }
362
363 // stringstream for concatenating xml parameter strings.
364 std::stringstream mueluss;
365 // create surrounding MueLu parameter list
366 mueluss << "<ParameterList name=\"MueLu\">" << std::endl;
367
368 // make sure that MueLu's phase1 matches ML's
369 mueluss << "<Parameter name=\"aggregation: match ML phase1\" type=\"bool\" value=\"true\"/>" << std::endl;
370
371 // make sure that MueLu's phase2a matches ML's
372 mueluss << "<Parameter name=\"aggregation: match ML phase2a\" type=\"bool\" value=\"true\"/>" << std::endl;
373
374 // make sure that MueLu's phase2b matches ML's
375 mueluss << "<Parameter name=\"aggregation: match ML phase2b\" type=\"bool\" value=\"true\"/>" << std::endl;
376
377 // make sure that MueLu's drop tol matches ML's
378 mueluss << "<Parameter name=\"aggregation: use ml scaling of drop tol\" type=\"bool\" value=\"true\"/>" << std::endl;
379
380 // loop over all ML parameters in provided parameter list
381 for (ParameterList::ConstIterator param = paramListWithSubList.begin(); param != paramListWithSubList.end(); ++param) {
382 // extract ML parameter name
383 const std::string &pname = paramListWithSubList.name(param);
384
385 // Short circuit the "parameterlist: syntax" parameter
386 // We want to remove this to make sure that createXpetraPreconditioner doesn't re-call translate()
387 if (pname == "parameterlist: syntax") {
388 continue;
389 }
390
391 // extract corresponding (ML) value
392 // remove ParameterList specific information from result string
393 std::stringstream valuess;
394 valuess << paramList.entry(param);
395 std::string valuestr = valuess.str();
396 replaceAll(valuestr, "[unused]", "");
397 replaceAll(valuestr, "[default]", "");
398 valuestr = trim(valuestr);
399
400 // transform ML parameter to corresponding MueLu parameter and generate XML string
401 std::string valueInterpreterStr = "\"" + valuestr + "\"";
402 std::string ret = MasterList::interpretParameterName(MasterList::ML2MueLu(pname), valueInterpreterStr);
403
404 if ((pname == "aggregation: aux: enable") && (paramListWithSubList.get<bool>("aggregation: aux: enable"))) {
405 mueluss << "<Parameter name=\"aggregation: drop scheme\" type=\"string\" value=\""
406 << "distance laplacian"
407 << "\"/>" << std::endl;
408 }
409
410 // special handling for verbosity level
411 if (pname == "ML output") {
412 // Translate verbosity parameter
413 int verbosityLevel = std::stoi(valuestr);
414 std::string eVerbLevel = "none";
415 if (verbosityLevel == 0) eVerbLevel = "none";
416 if (verbosityLevel >= 1) eVerbLevel = "low";
417 if (verbosityLevel >= 5) eVerbLevel = "medium";
418 if (verbosityLevel >= 10) eVerbLevel = "high";
419 if (verbosityLevel >= 11) eVerbLevel = "extreme";
420 if (verbosityLevel >= 42) eVerbLevel = "test";
421 if (verbosityLevel >= 666) eVerbLevel = "interfacetest";
422 mueluss << "<Parameter name=\"verbosity\" type=\"string\" value=\"" << eVerbLevel << "\"/>" << std::endl;
423 continue;
424 }
425
426 // add XML string
427 if (ret != "") {
428 mueluss << ret << std::endl;
429
430 // remove parameter from ML parameter list
431 adaptingParamList.remove(pname, false);
432 }
433
434 // special handling for energy minimization
435 // TAW: this is not optimal for symmetric problems but at least works.
436 // for symmetric problems the "energy minimization" parameter should not exist anyway...
437 if (pname == "energy minimization: enable") {
438 mueluss << "<Parameter name=\"problem: symmetric\" type=\"bool\" value=\"false\"/>" << std::endl;
439 mueluss << "<Parameter name=\"transpose: use implicit\" type=\"bool\" value=\"false\"/>" << std::endl;
440 }
441
442 // special handling for smoothers
443 if (pname == "smoother: type") {
444 mueluss << GetSmootherFactory(paramList, adaptingParamList, pname, valuestr);
445 }
446
447 // special handling for level-specific smoothers
448 if (pname.find("smoother: list (level", 0) == 0) {
449 // Scan pname (ex: pname="smoother: type (level 2)")
450 std::string type, option;
451 int levelID = -1;
452 {
453 typedef Teuchos::ArrayRCP<char>::size_type size_type;
454 Teuchos::Array<char> ctype(size_type(pname.size() + 1));
455 Teuchos::Array<char> coption(size_type(pname.size() + 1));
456
457 int matched = sscanf(pname.c_str(), "%s %[^(](level %d)", ctype.getRawPtr(), coption.getRawPtr(), &levelID); // use [^(] instead of %s to allow for strings with white-spaces (ex: "ifpack list")
458 type = std::string(ctype.getRawPtr());
459 option = std::string(coption.getRawPtr());
460 option.resize(option.size() - 1); // remove final white-space
461
462 if (matched != 3 || (type != "smoother:")) {
463 TEUCHOS_TEST_FOR_EXCEPTION(true, MueLu::Exceptions::RuntimeError, "MueLu::CreateSublist(), Line " << __LINE__ << ". "
464 << "Error in creating level-specific sublists" << std::endl
465 << "Offending parameter: " << pname << std::endl);
466 }
467
468 mueluss << "<ParameterList name=\"level " << levelID << "\">" << std::endl;
469 mueluss << GetSmootherFactory(paramList.sublist(pname), adaptingParamList.sublist(pname), "smoother: type", paramList.sublist(pname).get<std::string>("smoother: type"));
470 mueluss << "</ParameterList>" << std::endl;
471 }
472 }
473 // special handling for coarse level
474 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter("coarse: type"), Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter::Setup(): The parameter \"coarse: type\" should not exist but being stored in \"coarse: list\" instead.");
475
476 if (pname == "coarse: list") {
477 // interpret smoother/coarse solver data.
478 // Note, that we inspect the "coarse: list" sublist to define the "coarse" smoother/solver
479 // Be aware, that MueLu::CreateSublists renames the prefix of the parameters in the "coarse: list" from "coarse" to "smoother".
480 // Therefore, we have to check the values of the "smoother" parameters
481
482 // DO we have a coarse list / smoother type? If not, assume KLU
483 std::string coarse_smoother = "Amesos-KLU";
484 if (paramList.sublist("coarse: list").isParameter("smoother: type"))
485 coarse_smoother = paramList.sublist("coarse: list").get<std::string>("smoother: type");
486
487 mueluss << GetSmootherFactory(paramList.sublist("coarse: list"), adaptingParamList.sublist("coarse: list"), "coarse: type", coarse_smoother);
488 }
489 } // for
490 mueluss << "</ParameterList>" << std::endl;
491
492 return mueluss.str();
493}
494
495static void ML_OverwriteDefaults(ParameterList &inList, ParameterList &List, bool OverWrite) {
496 ParameterList *coarseList = 0;
497 // Don't create the coarse list if it doesn't already exist!
498 if (inList.isSublist("coarse: list"))
499 coarseList = &(inList.sublist("coarse: list"));
500 for (ParameterList::ConstIterator param = List.begin(); param != List.end(); param++) {
501 std::string pname = List.name(param);
502 if (coarseList && pname.find("coarse: ", 0) != std::string::npos) {
503 if (!coarseList->isParameter(pname) || OverWrite)
504 coarseList->setEntry(pname, List.entry(param));
505 } else if (!inList.isParameter(pname) || OverWrite) {
506 inList.setEntry(pname, List.entry(param));
507 }
508 }
509} // ML_OverwriteDefaults()
510
511static int UpdateList(Teuchos::ParameterList &source, Teuchos::ParameterList &dest, bool OverWrite) {
512 for (Teuchos::ParameterList::ConstIterator param = source.begin(); param != source.end(); param++)
513 if (dest.isParameter(source.name(param)) == false || OverWrite)
514 dest.setEntry(source.name(param), source.entry(param));
515 return 0;
516}
517
518int ML2MueLuParameterTranslator::SetDefaults(std::string ProblemType, Teuchos::ParameterList &List,
519 int *ioptions, double *iparams, const bool OverWrite) {
520 Teuchos::RCP<std::vector<int> > options;
521 Teuchos::RCP<std::vector<double> > params;
522
523 // Taken from AztecOO
524 const int MUELU_AZ_OPTIONS_SIZE = 47;
525 const int MUELU_AZ_PARAMS_SIZE = 30;
526
527 /*bool SetDefaults = false;
528 if (ioptions == NULL || iparams == NULL)
529 SetDefaults = true;*/
530
531 if (ioptions == NULL)
532 options = rcp(new std::vector<int>(MUELU_AZ_OPTIONS_SIZE));
533 else
534 options = rcp(new std::vector<int>(ioptions, ioptions + MUELU_AZ_OPTIONS_SIZE));
535 if (iparams == NULL)
536 params = rcp(new std::vector<double>(MUELU_AZ_PARAMS_SIZE));
537 else
538 params = rcp(new std::vector<double>(iparams, iparams + MUELU_AZ_PARAMS_SIZE));
539
540 // if (SetDefaults)
541 // AZ_defaults(&(*options)[0],&(*params)[0]);
542
543 if (ProblemType == "SA") {
544 SetDefaultsSA(List, options, params, OverWrite);
545 } else if (ProblemType == "DD") {
546 SetDefaultsDD(List, options, params, OverWrite);
547 } else if (ProblemType == "DD-ML") {
548 SetDefaultsDD_3Levels(List, options, params, OverWrite);
549 } else if (ProblemType == "maxwell" || ProblemType == "Maxwell") {
550 SetDefaultsMaxwell(List, options, params, OverWrite);
551 } else if (ProblemType == "NSSA") {
552 SetDefaultsNSSA(List, options, params, OverWrite);
553 } else if (ProblemType == "DD-ML-LU") {
554 SetDefaultsDD_3Levels_LU(List, options, params, OverWrite);
555 } else if (ProblemType == "DD-LU") {
556 SetDefaultsDD_LU(List, options, params, OverWrite);
557 } else if (ProblemType == "Classical-AMG") {
558 SetDefaultsClassicalAMG(List, options, params, OverWrite);
559 } else {
560 std::cerr << "ERROR: Wrong input parameter in `SetDefaults' ("
561 << ProblemType << "). Should be: " << std::endl
562 << "ERROR: <SA> / <DD> / <DD-ML> / <maxwell>" << std::endl;
563 }
564 return (0);
565}
566
568 Teuchos::RCP<std::vector<int> > & /* options */,
569 Teuchos::RCP<std::vector<double> > & /* params */,
570 bool OverWrite) {
571 ParameterList List;
572 inList.setName("SA default values");
573 List.set("default values", "SA");
574 List.set("max levels", 10);
575 List.set("prec type", "MGV");
576 List.set("increasing or decreasing", "increasing");
577
578 List.set("aggregation: type", "Uncoupled-MIS");
579 List.set("aggregation: damping factor", 1.333);
580 List.set("eigen-analysis: type", "cg");
581 List.set("eigen-analysis: iterations", 10);
582
583 List.set("smoother: sweeps", 2);
584 List.set("smoother: damping factor", 1.0);
585 List.set("smoother: pre or post", "both");
586 List.set("smoother: type", "symmetric Gauss-Seidel");
587
588 List.set("coarse: type", "Amesos-KLU");
589 List.set("coarse: max size", 128);
590 List.set("coarse: pre or post", "post");
591 List.set("coarse: sweeps", 1);
592 List.set("coarse: split communicator", false);
593
594 // Make sure we know this follows the ML defaults
595 List.set("parameterlist: syntax", "ml");
596
597 ML_OverwriteDefaults(inList, List, OverWrite);
598 return 0;
599} // ML2MueLuParameterTranslator::SetDefaultsSA()
600
602 Teuchos::RCP<std::vector<int> > &options,
603 Teuchos::RCP<std::vector<double> > &params,
604 bool OverWrite) {
605 ParameterList List;
606
607 inList.setName("DD default values");
608 List.set("default values", "DD");
609 List.set("max levels", 2);
610 List.set("prec type", "MGV");
611 List.set("increasing or decreasing", "increasing");
612
613 List.set("aggregation: type", "METIS");
614 List.set("aggregation: local aggregates", 1);
615 List.set("aggregation: damping factor", 1.333);
616 List.set("eigen-analysis: type", "power-method");
617 List.set("eigen-analysis: iterations", 20);
618
619 List.set("smoother: sweeps", 1);
620 List.set("smoother: pre or post", "both");
621 /*#ifdef HAVE_ML_AZTECOO
622 List.set("smoother: type","Aztec");
623 (*options)[AZ_precond] = AZ_dom_decomp;
624 (*options)[AZ_subdomain_solve] = AZ_ilu;
625 List.set("smoother: Aztec options",options);
626 List.set("smoother: Aztec params",params);
627 List.set("smoother: Aztec as solver",false);
628 #endif*/
629
630 List.set("coarse: type", "Amesos-KLU");
631 List.set("coarse: max size", 128);
632 List.set("coarse: pre or post", "post");
633 List.set("coarse: sweeps", 1);
634
635 // Make sure we know this follows the ML defaults
636 List.set("parameterlist: syntax", "ml");
637
638 ML_OverwriteDefaults(inList, List, OverWrite);
639 return 0;
640} // ML2MueLuParameterTranslator::SetDefaultsDD()
641
643 Teuchos::RCP<std::vector<int> > &options,
644 Teuchos::RCP<std::vector<double> > &params,
645 bool OverWrite) {
646 ParameterList List;
647
648 inList.setName("DD-ML default values");
649 List.set("default values", "DD-ML");
650
651 List.set("max levels", 3);
652 List.set("prec type", "MGV");
653 List.set("increasing or decreasing", "increasing");
654
655 List.set("aggregation: type", "METIS");
656 List.set("aggregation: nodes per aggregate", 512);
657 List.set("aggregation: next-level aggregates per process", 128);
658 List.set("aggregation: damping factor", 1.333);
659 List.set("eigen-analysis: type", "power-method");
660 List.set("eigen-analysis: iterations", 20);
661
662 List.set("smoother: sweeps", 1);
663 List.set("smoother: pre or post", "both");
664 /*#ifdef HAVE_ML_AZTECOO
665 List.set("smoother: type","Aztec");
666 (*options)[AZ_precond] = AZ_dom_decomp;
667 (*options)[AZ_subdomain_solve] = AZ_ilu;
668 List.set("smoother: Aztec options",options);
669 List.set("smoother: Aztec params",params);
670 List.set("smoother: Aztec as solver",false);
671 #endif*/
672
673 List.set("coarse: type", "Amesos-KLU");
674 List.set("coarse: max size", 128);
675 List.set("coarse: pre or post", "post");
676 List.set("coarse: sweeps", 1);
677
678 // Make sure we know this follows the ML defaults
679 List.set("parameterlist: syntax", "ml");
680
681 ML_OverwriteDefaults(inList, List, OverWrite);
682 return 0;
683} // ML2MueLuParameterTranslator::SetDefaultsDD_3Levels()
684
686 Teuchos::RCP<std::vector<int> > & /* options */,
687 Teuchos::RCP<std::vector<double> > & /* params */,
688 bool OverWrite) {
689 ParameterList List;
690
691 inList.setName("Maxwell default values");
692 List.set("default values", "maxwell");
693 List.set("max levels", 10);
694 List.set("prec type", "MGV");
695 List.set("increasing or decreasing", "decreasing");
696
697 List.set("aggregation: type", "Uncoupled-MIS");
698 List.set("aggregation: damping factor", 1.333);
699 List.set("eigen-analysis: type", "cg");
700 List.set("eigen-analysis: iterations", 10);
701 // dropping threshold for small entries in edge prolongator
702 List.set("aggregation: edge prolongator drop threshold", 0.0);
703
704 List.set("smoother: sweeps", 1);
705 List.set("smoother: damping factor", 1.0);
706 List.set("smoother: pre or post", "both");
707 List.set("smoother: type", "Hiptmair");
708 List.set("smoother: Hiptmair efficient symmetric", true);
709 List.set("subsmoother: type", "Chebyshev"); // Hiptmair subsmoother options
710 List.set("subsmoother: Chebyshev alpha", 20.0);
711 List.set("subsmoother: node sweeps", 4);
712 List.set("subsmoother: edge sweeps", 4);
713
714 // direct solver on coarse problem
715 List.set("coarse: type", "Amesos-KLU");
716 List.set("coarse: max size", 128);
717 List.set("coarse: pre or post", "post");
718 List.set("coarse: sweeps", 1);
719
720 // Make sure we know this follows the ML defaults
721 List.set("parameterlist: syntax", "ml");
722
723 ML_OverwriteDefaults(inList, List, OverWrite);
724 return 0;
725} // ML2MueLuParameterTranslator::SetDefaultsMaxwell()
726
728 Teuchos::RCP<std::vector<int> > & /* options */,
729 Teuchos::RCP<std::vector<double> > & /* params */,
730 bool OverWrite) {
731 ParameterList List;
732
733 inList.setName("NSSA default values");
734 List.set("default values", "NSSA");
735 List.set("max levels", 10);
736 List.set("prec type", "MGW");
737 List.set("increasing or decreasing", "increasing");
738
739 List.set("aggregation: type", "Uncoupled-MIS");
740 List.set("energy minimization: enable", true);
741 List.set("eigen-analysis: type", "power-method");
742 List.set("eigen-analysis: iterations", 20);
743
744 List.set("smoother: sweeps", 4);
745 List.set("smoother: damping factor", .67);
746 List.set("smoother: pre or post", "post");
747 List.set("smoother: type", "symmetric Gauss-Seidel");
748
749 List.set("coarse: type", "Amesos-KLU");
750 List.set("coarse: max size", 256);
751 List.set("coarse: pre or post", "post");
752 List.set("coarse: sweeps", 1);
753
754 // Make sure we know this follows the ML defaults
755 List.set("parameterlist: syntax", "ml");
756
757 ML_OverwriteDefaults(inList, List, OverWrite);
758 return 0;
759} // ML2MueLuParameterTranslator::SetDefaultsNSSA()
760
762 Teuchos::RCP<std::vector<int> > &options,
763 Teuchos::RCP<std::vector<double> > &params,
764 bool OverWrite) {
765 ParameterList List;
766
767 inList.setName("DD-LU default values");
768 List.set("default values", "DD-LU");
769 List.set("max levels", 2);
770 List.set("prec type", "MGV");
771 List.set("increasing or decreasing", "increasing");
772
773 List.set("aggregation: type", "METIS");
774 List.set("aggregation: local aggregates", 1);
775 List.set("aggregation: damping factor", 1.333);
776 List.set("eigen-analysis: type", "power-method");
777 List.set("eigen-analysis: iterations", 20);
778
779 List.set("smoother: sweeps", 1);
780 List.set("smoother: pre or post", "both");
781
782 /*#ifdef HAVE_ML_AZTECOO
783 List.set("smoother: type","Aztec");
784 (*options)[AZ_precond] = AZ_dom_decomp;
785 (*options)[AZ_subdomain_solve] = AZ_lu;
786 List.set("smoother: Aztec options",options);
787 List.set("smoother: Aztec params",params);
788 List.set("smoother: Aztec as solver",false);
789 #endif*/
790
791 List.set("coarse: type", "Amesos-KLU");
792 List.set("coarse: max size", 128);
793 List.set("coarse: pre or post", "post");
794 List.set("coarse: sweeps", 1);
795
796 // Make sure we know this follows the ML defaults
797 List.set("parameterlist: syntax", "ml");
798
799 ML_OverwriteDefaults(inList, List, OverWrite);
800 return 0;
801} // ML2MueLuParameterTranslator::SetDefaultsDD_LU()
802
804 Teuchos::RCP<std::vector<int> > &options,
805 Teuchos::RCP<std::vector<double> > &params,
806 bool OverWrite) {
807 ParameterList List;
808
809 inList.setName("DD-ML-LU default values");
810 List.set("default values", "DD-ML-LU");
811 List.set("max levels", 3);
812 List.set("prec type", "MGV");
813 List.set("increasing or decreasing", "increasing");
814
815 List.set("aggregation: type", "METIS");
816 List.set("aggregation: nodes per aggregate", 512);
817 List.set("aggregation: next-level aggregates per process", 128);
818 List.set("aggregation: damping factor", 1.333);
819
820 List.set("smoother: sweeps", 1);
821 List.set("smoother: pre or post", "both");
822 /*#ifdef HAVE_ML_AZTECOO
823 List.set("smoother: type","Aztec");
824 (*options)[AZ_precond] = AZ_dom_decomp;
825 (*options)[AZ_subdomain_solve] = AZ_lu;
826 List.set("smoother: Aztec options",options);
827 List.set("smoother: Aztec params",params);
828 List.set("smoother: Aztec as solver",false);
829 #endif*/
830 List.set("coarse: type", "Amesos-KLU");
831 List.set("coarse: max size", 128);
832 List.set("coarse: pre or post", "post");
833 List.set("coarse: sweeps", 1);
834
835 ML_OverwriteDefaults(inList, List, OverWrite);
836 return 0;
837} // ML2MueLuParameterTranslator::SetDefaultsDD_3Levels_LU()
838
840 Teuchos::RCP<std::vector<int> > & /* options */,
841 Teuchos::RCP<std::vector<double> > & /* params */,
842 bool OverWrite) {
843 ParameterList List;
844
845 inList.setName("Classical-AMG default values");
846 List.set("default values", "Classical-AMG");
847 List.set("max levels", 10);
848 List.set("prec type", "MGV");
849 List.set("increasing or decreasing", "increasing");
850 List.set("smoother: sweeps", 2);
851 List.set("smoother: damping factor", 1.0);
852 List.set("smoother: pre or post", "both");
853 List.set("smoother: type", "symmetric Gauss-Seidel");
854
855 List.set("coarse: type", "Amesos-KLU");
856 List.set("coarse: max size", 128);
857 List.set("coarse: pre or post", "post");
858 List.set("coarse: sweeps", 1);
859
860 // Make sure we know this follows the ML defaults
861 List.set("parameterlist: syntax", "ml");
862
863 ML_OverwriteDefaults(inList, List, OverWrite);
864 return 0;
865} // ML2MueLuParameterTranslator::SetDefaultsClassicalAMG()
866
867int ML2MueLuParameterTranslator::SetDefaultsRefMaxwell(Teuchos::ParameterList &inList, bool OverWrite) {
868 /* Sublists */
869 Teuchos::ParameterList ListRF, List11, List11c, List22, dummy;
870 Teuchos::ParameterList &List11_ = inList.sublist("refmaxwell: 11list");
871 Teuchos::ParameterList &List22_ = inList.sublist("refmaxwell: 22list");
872 Teuchos::ParameterList &List11c_ = List11_.sublist("edge matrix free: coarse");
873
874 /* Build Teuchos List: (1,1) coarse */
875 SetDefaults("SA", List11c);
876 List11c.remove("parameterlist: syntax");
877 List11c.set("cycle applications", 1);
878 List11c.set("smoother: type", "Chebyshev");
879 List11c.set("aggregation: threshold", .01);
880 List11c.set("coarse: type", "Amesos-KLU");
881 List11c.set("ML label", "coarse (1,1) block");
882 UpdateList(List11c, List11c_, OverWrite);
883
884 /* Build Teuchos List: (1,1) */
885 SetDefaults("SA", List11);
886 List11.remove("parameterlist: syntax");
887 List11.set("cycle applications", 1);
888 List11.set("aggregation: type", "Uncoupled");
889 List11.set("smoother: sweeps", 0);
890 List11.set("aggregation: damping factor", 0.0);
891 List11.set("edge matrix free: coarse", List11c);
892 List11.set("aggregation: threshold", .01);
893 UpdateList(List11, List11_, OverWrite);
894
895 /* Build Teuchos List: (2,2) */
896 SetDefaults("SA", List22);
897 List22.remove("parameterlist: syntax");
898 List22.set("cycle applications", 1);
899 List22.set("smoother: type", "Chebyshev");
900 List22.set("aggregation: type", "Uncoupled");
901 List22.set("aggregation: threshold", .01);
902 List22.set("coarse: type", "Amesos-KLU");
903 List22.set("ML label", "(2,2) block");
904
905 // This line is commented out due to IFPACK issues
906 // List22.set("smoother: sweeps (level 0)",0);
907 UpdateList(List22, List22_, OverWrite);
908
909 /* Build Teuchos List: Overall */
910 SetDefaults("maxwell", ListRF, 0, 0, false);
911 ListRF.set("smoother: type", "Chebyshev");
912 ListRF.set("smoother: sweeps", 2);
913 ListRF.set("refmaxwell: 11solver", "edge matrix free"); // either "edge matrix free" or "sa"
914 ListRF.set("refmaxwell: 11list", List11);
915 ListRF.set("refmaxwell: 22solver", "multilevel");
916 ListRF.set("refmaxwell: 22list", List22);
917 ListRF.set("refmaxwell: mode", "additive");
918 ListRF.set("default values", "RefMaxwell");
919 ListRF.set("zero starting solution", false);
920
921 // Make sure we know this follows the ML defaults
922 ListRF.set("parameterlist: syntax", "ml");
923
924 UpdateList(ListRF, inList, OverWrite);
925
926 return 0;
927} /*end SetDefaultsRefMaxwell*/
928
929} // namespace MueLu
Exception throws to report errors in the internal logical of the program.
static int SetDefaultsClassicalAMG(Teuchos::ParameterList &List, Teuchos::RCP< std::vector< int > > &options, Teuchos::RCP< std::vector< double > > &params, bool Overwrite=true)
Sets defaults for classical amg.
static int SetDefaultsNSSA(Teuchos::ParameterList &List, Teuchos::RCP< std::vector< int > > &options, Teuchos::RCP< std::vector< double > > &params, bool Overwrite=true)
Sets defaults for energy minimization preconditioning for nonsymmetric problems.
static int SetDefaultsSA(Teuchos::ParameterList &List, Teuchos::RCP< std::vector< int > > &options, Teuchos::RCP< std::vector< double > > &params, bool Overwrite=true)
Sets default parameters for classical smoothed aggregation.
static int SetDefaultsDD_3Levels_LU(Teuchos::ParameterList &List, Teuchos::RCP< std::vector< int > > &options, Teuchos::RCP< std::vector< double > > &params, bool Overwrite=true)
Sets default parameters for aggregation-based 3-level domain decomposition preconditioners with LU.
static std::string SetParameterList(const Teuchos::ParameterList &paramList_in, const std::string &defaultVals)
: Interpret parameter list
static int SetDefaultsMaxwell(Teuchos::ParameterList &List, Teuchos::RCP< std::vector< int > > &options, Teuchos::RCP< std::vector< double > > &params, bool Overwrite=true)
Sets default parameters for the eddy current equations equations.
static int SetDefaultsDD(Teuchos::ParameterList &List, Teuchos::RCP< std::vector< int > > &options, Teuchos::RCP< std::vector< double > > &params, bool Overwrite=true)
Sets default parameters for aggregation-based 2-level domain decomposition preconditioners.
static int SetDefaultsRefMaxwell(Teuchos::ParameterList &inList, bool OverWrite=true)
Sets defaults for RefMaxwell / Maxwell2.
static int SetDefaults(std::string ProblemType, Teuchos::ParameterList &List, int *options=0, double *params=0, const bool OverWrite=true)
Sets ML's (not MueLu's) default parameters for aggregation-based preconditioners.
static int SetDefaultsDD_LU(Teuchos::ParameterList &List, Teuchos::RCP< std::vector< int > > &options, Teuchos::RCP< std::vector< double > > &params, bool Overwrite=true)
Sets default parameters for aggregation-based 2-level domain decomposition preconditioners,...
static std::string GetSmootherFactory(const Teuchos::ParameterList &paramList, Teuchos::ParameterList &adaptingParamList, const std::string &pname, const std::string &value)
: Helper function which translates ML smoother/solver paramters to MueLu XML string
static int SetDefaultsDD_3Levels(Teuchos::ParameterList &List, Teuchos::RCP< std::vector< int > > &options, Teuchos::RCP< std::vector< double > > &params, bool Overwrite=true)
Sets default parameters for aggregation-based 3-level domain decomposition preconditioners.
static std::string ML2MueLu(const std::string &name)
Translate ML parameter to corresponding MueLu parameter.
static std::string interpretParameterName(const std::string &name, const std::string &value)
Namespace for MueLu classes and methods.
void CreateSublists(const Teuchos::ParameterList &List, Teuchos::ParameterList &newList)
static int UpdateList(Teuchos::ParameterList &source, Teuchos::ParameterList &dest, bool OverWrite)
void replaceAll(std::string &str, const std::string &from, const std::string &to)
void MergeParameterList(const Teuchos::ParameterList &source, Teuchos::ParameterList &dest, bool overWrite)
: merge two parameter lists
static void ML_OverwriteDefaults(ParameterList &inList, ParameterList &List, bool OverWrite)