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 // make sure that MueLu's SaP diagonal behavior matches ML's
381 mueluss << "<Parameter name=\"sa: diagonal replacement tolerance\" type=\"double\" value=\"0.0\"/>" << std::endl;
382
383 // loop over all ML parameters in provided parameter list
384 for (ParameterList::ConstIterator param = paramListWithSubList.begin(); param != paramListWithSubList.end(); ++param) {
385 // extract ML parameter name
386 const std::string& pname = paramListWithSubList.name(param);
387
388 // Short circuit the "parameterlist: syntax" parameter
389 // We want to remove this to make sure that createXpetraPreconditioner doesn't re-call translate()
390 if (pname == "parameterlist: syntax") {
391 continue;
392 }
393
394 // extract corresponding (ML) value
395 // remove ParameterList specific information from result string
396 std::stringstream valuess;
397 valuess << paramList.entry(param);
398 std::string valuestr = valuess.str();
399 replaceAll(valuestr, "[unused]", "");
400 replaceAll(valuestr, "[default]", "");
401 valuestr = trim(valuestr);
402
403 // transform ML parameter to corresponding MueLu parameter and generate XML string
404 std::string valueInterpreterStr = "\"" + valuestr + "\"";
405 std::string ret = MasterList::interpretParameterName(MasterList::ML2MueLu(pname), valueInterpreterStr);
406
407 if ((pname == "aggregation: aux: enable") && (paramListWithSubList.get<bool>("aggregation: aux: enable"))) {
408 mueluss << "<Parameter name=\"aggregation: drop scheme\" type=\"string\" value=\""
409 << "distance laplacian"
410 << "\"/>" << std::endl;
411 }
412
413 // special handling for verbosity level
414 if (pname == "ML output") {
415 // Translate verbosity parameter
416 int verbosityLevel = std::stoi(valuestr);
417 std::string eVerbLevel = "none";
418 if (verbosityLevel == 0) eVerbLevel = "none";
419 if (verbosityLevel >= 1) eVerbLevel = "low";
420 if (verbosityLevel >= 5) eVerbLevel = "medium";
421 if (verbosityLevel >= 10) eVerbLevel = "high";
422 if (verbosityLevel >= 11) eVerbLevel = "extreme";
423 if (verbosityLevel >= 42) eVerbLevel = "test";
424 if (verbosityLevel >= 666) eVerbLevel = "interfacetest";
425 mueluss << "<Parameter name=\"verbosity\" type=\"string\" value=\"" << eVerbLevel << "\"/>" << std::endl;
426 continue;
427 }
428
429 // add XML string
430 if (ret != "") {
431 mueluss << ret << std::endl;
432
433 // remove parameter from ML parameter list
434 adaptingParamList.remove(pname, false);
435 }
436
437 // special handling for energy minimization
438 // TAW: this is not optimal for symmetric problems but at least works.
439 // for symmetric problems the "energy minimization" parameter should not exist anyway...
440 if (pname == "energy minimization: enable") {
441 mueluss << "<Parameter name=\"problem: symmetric\" type=\"bool\" value=\"false\"/>" << std::endl;
442 mueluss << "<Parameter name=\"transpose: use implicit\" type=\"bool\" value=\"false\"/>" << std::endl;
443 }
444
445 // special handling for smoothers
446 if (pname == "smoother: type") {
447 mueluss << GetSmootherFactory(paramList, adaptingParamList, pname, valuestr);
448 }
449
450 // special handling for level-specific smoothers
451 if (pname.find("smoother: list (level", 0) == 0) {
452 // Scan pname (ex: pname="smoother: type (level 2)")
453 std::string type, option;
454 int levelID = -1;
455 {
456 typedef Teuchos::ArrayRCP<char>::size_type size_type;
457 Teuchos::Array<char> ctype(size_type(pname.size() + 1));
458 Teuchos::Array<char> coption(size_type(pname.size() + 1));
459
460 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")
461 type = std::string(ctype.getRawPtr());
462 option = std::string(coption.getRawPtr());
463 option.resize(option.size() - 1); // remove final white-space
464
465 if (matched != 3 || (type != "smoother:")) {
466 TEUCHOS_TEST_FOR_EXCEPTION(true, MueLu::Exceptions::RuntimeError, "MueLu::CreateSublist(), Line " << __LINE__ << ". "
467 << "Error in creating level-specific sublists" << std::endl
468 << "Offending parameter: " << pname << std::endl);
469 }
470
471 mueluss << "<ParameterList name=\"level " << levelID << "\">" << std::endl;
472 mueluss << GetSmootherFactory(paramList.sublist(pname), adaptingParamList.sublist(pname), "smoother: type", paramList.sublist(pname).get<std::string>("smoother: type"));
473 mueluss << "</ParameterList>" << std::endl;
474 }
475 }
476 // special handling for coarse level
477 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.");
478
479 if (pname == "coarse: list") {
480 // interpret smoother/coarse solver data.
481 // Note, that we inspect the "coarse: list" sublist to define the "coarse" smoother/solver
482 // Be aware, that MueLu::CreateSublists renames the prefix of the parameters in the "coarse: list" from "coarse" to "smoother".
483 // Therefore, we have to check the values of the "smoother" parameters
484
485 // DO we have a coarse list / smoother type? If not, assume KLU
486 std::string coarse_smoother = "Amesos-KLU";
487 if (paramList.sublist("coarse: list").isParameter("smoother: type"))
488 coarse_smoother = paramList.sublist("coarse: list").get<std::string>("smoother: type");
489
490 mueluss << GetSmootherFactory(paramList.sublist("coarse: list"), adaptingParamList.sublist("coarse: list"), "coarse: type", coarse_smoother);
491 }
492 } // for
493 mueluss << "</ParameterList>" << std::endl;
494
495 return mueluss.str();
496}
497
498static void ML_OverwriteDefaults(ParameterList& inList, ParameterList& List, bool OverWrite) {
499 ParameterList* coarseList = 0;
500 // Don't create the coarse list if it doesn't already exist!
501 if (inList.isSublist("coarse: list"))
502 coarseList = &(inList.sublist("coarse: list"));
503 for (ParameterList::ConstIterator param = List.begin(); param != List.end(); param++) {
504 std::string pname = List.name(param);
505 if (coarseList && pname.find("coarse: ", 0) != std::string::npos) {
506 if (!coarseList->isParameter(pname) || OverWrite)
507 coarseList->setEntry(pname, List.entry(param));
508 } else if (!inList.isParameter(pname) || OverWrite) {
509 inList.setEntry(pname, List.entry(param));
510 }
511 }
512} // ML_OverwriteDefaults()
513
514static int UpdateList(Teuchos::ParameterList& source, Teuchos::ParameterList& dest, bool OverWrite) {
515 for (Teuchos::ParameterList::ConstIterator param = source.begin(); param != source.end(); param++)
516 if (dest.isParameter(source.name(param)) == false || OverWrite)
517 dest.setEntry(source.name(param), source.entry(param));
518 return 0;
519}
520
521int ML2MueLuParameterTranslator::SetDefaults(std::string ProblemType, Teuchos::ParameterList& List,
522 int* ioptions, double* iparams, const bool OverWrite) {
523 Teuchos::RCP<std::vector<int> > options;
524 Teuchos::RCP<std::vector<double> > params;
525
526 // Taken from AztecOO
527 const int MUELU_AZ_OPTIONS_SIZE = 47;
528 const int MUELU_AZ_PARAMS_SIZE = 30;
529
530 /*bool SetDefaults = false;
531 if (ioptions == NULL || iparams == NULL)
532 SetDefaults = true;*/
533
534 if (ioptions == NULL)
535 options = rcp(new std::vector<int>(MUELU_AZ_OPTIONS_SIZE));
536 else
537 options = rcp(new std::vector<int>(ioptions, ioptions + MUELU_AZ_OPTIONS_SIZE));
538 if (iparams == NULL)
539 params = rcp(new std::vector<double>(MUELU_AZ_PARAMS_SIZE));
540 else
541 params = rcp(new std::vector<double>(iparams, iparams + MUELU_AZ_PARAMS_SIZE));
542
543 // if (SetDefaults)
544 // AZ_defaults(&(*options)[0],&(*params)[0]);
545
546 if (ProblemType == "SA") {
547 SetDefaultsSA(List, options, params, OverWrite);
548 } else if (ProblemType == "DD") {
549 SetDefaultsDD(List, options, params, OverWrite);
550 } else if (ProblemType == "DD-ML") {
551 SetDefaultsDD_3Levels(List, options, params, OverWrite);
552 } else if (ProblemType == "maxwell" || ProblemType == "Maxwell") {
553 SetDefaultsMaxwell(List, options, params, OverWrite);
554 } else if (ProblemType == "NSSA") {
555 SetDefaultsNSSA(List, options, params, OverWrite);
556 } else if (ProblemType == "DD-ML-LU") {
557 SetDefaultsDD_3Levels_LU(List, options, params, OverWrite);
558 } else if (ProblemType == "DD-LU") {
559 SetDefaultsDD_LU(List, options, params, OverWrite);
560 } else if (ProblemType == "Classical-AMG") {
561 SetDefaultsClassicalAMG(List, options, params, OverWrite);
562 } else {
563 std::cerr << "ERROR: Wrong input parameter in `SetDefaults' ("
564 << ProblemType << "). Should be: " << std::endl
565 << "ERROR: <SA> / <DD> / <DD-ML> / <maxwell>" << std::endl;
566 }
567 return (0);
568}
569
571 Teuchos::RCP<std::vector<int> >& /* options */,
572 Teuchos::RCP<std::vector<double> >& /* params */,
573 bool OverWrite) {
574 ParameterList List;
575 inList.setName("SA default values");
576 List.set("default values", "SA");
577 List.set("max levels", 10);
578 List.set("prec type", "MGV");
579 List.set("increasing or decreasing", "increasing");
580
581 List.set("aggregation: type", "Uncoupled-MIS");
582 List.set("aggregation: damping factor", 1.333);
583 List.set("eigen-analysis: type", "cg");
584 List.set("eigen-analysis: iterations", 10);
585
586 List.set("smoother: sweeps", 2);
587 List.set("smoother: damping factor", 1.0);
588 List.set("smoother: pre or post", "both");
589 List.set("smoother: type", "symmetric Gauss-Seidel");
590
591 List.set("coarse: type", "Amesos-KLU");
592 List.set("coarse: max size", 128);
593 List.set("coarse: pre or post", "post");
594 List.set("coarse: sweeps", 1);
595 List.set("coarse: split communicator", false);
596
597 // Make sure we know this follows the ML defaults
598 List.set("parameterlist: syntax", "ml");
599
600 ML_OverwriteDefaults(inList, List, OverWrite);
601 return 0;
602} // ML2MueLuParameterTranslator::SetDefaultsSA()
603
605 Teuchos::RCP<std::vector<int> >& options,
606 Teuchos::RCP<std::vector<double> >& params,
607 bool OverWrite) {
608 ParameterList List;
609
610 inList.setName("DD default values");
611 List.set("default values", "DD");
612 List.set("max levels", 2);
613 List.set("prec type", "MGV");
614 List.set("increasing or decreasing", "increasing");
615
616 List.set("aggregation: type", "METIS");
617 List.set("aggregation: local aggregates", 1);
618 List.set("aggregation: damping factor", 1.333);
619 List.set("eigen-analysis: type", "power-method");
620 List.set("eigen-analysis: iterations", 20);
621
622 List.set("smoother: sweeps", 1);
623 List.set("smoother: pre or post", "both");
624 /*#ifdef HAVE_ML_AZTECOO
625 List.set("smoother: type","Aztec");
626 (*options)[AZ_precond] = AZ_dom_decomp;
627 (*options)[AZ_subdomain_solve] = AZ_ilu;
628 List.set("smoother: Aztec options",options);
629 List.set("smoother: Aztec params",params);
630 List.set("smoother: Aztec as solver",false);
631 #endif*/
632
633 List.set("coarse: type", "Amesos-KLU");
634 List.set("coarse: max size", 128);
635 List.set("coarse: pre or post", "post");
636 List.set("coarse: sweeps", 1);
637
638 // Make sure we know this follows the ML defaults
639 List.set("parameterlist: syntax", "ml");
640
641 ML_OverwriteDefaults(inList, List, OverWrite);
642 return 0;
643} // ML2MueLuParameterTranslator::SetDefaultsDD()
644
646 Teuchos::RCP<std::vector<int> >& options,
647 Teuchos::RCP<std::vector<double> >& params,
648 bool OverWrite) {
649 ParameterList List;
650
651 inList.setName("DD-ML default values");
652 List.set("default values", "DD-ML");
653
654 List.set("max levels", 3);
655 List.set("prec type", "MGV");
656 List.set("increasing or decreasing", "increasing");
657
658 List.set("aggregation: type", "METIS");
659 List.set("aggregation: nodes per aggregate", 512);
660 List.set("aggregation: next-level aggregates per process", 128);
661 List.set("aggregation: damping factor", 1.333);
662 List.set("eigen-analysis: type", "power-method");
663 List.set("eigen-analysis: iterations", 20);
664
665 List.set("smoother: sweeps", 1);
666 List.set("smoother: pre or post", "both");
667 /*#ifdef HAVE_ML_AZTECOO
668 List.set("smoother: type","Aztec");
669 (*options)[AZ_precond] = AZ_dom_decomp;
670 (*options)[AZ_subdomain_solve] = AZ_ilu;
671 List.set("smoother: Aztec options",options);
672 List.set("smoother: Aztec params",params);
673 List.set("smoother: Aztec as solver",false);
674 #endif*/
675
676 List.set("coarse: type", "Amesos-KLU");
677 List.set("coarse: max size", 128);
678 List.set("coarse: pre or post", "post");
679 List.set("coarse: sweeps", 1);
680
681 // Make sure we know this follows the ML defaults
682 List.set("parameterlist: syntax", "ml");
683
684 ML_OverwriteDefaults(inList, List, OverWrite);
685 return 0;
686} // ML2MueLuParameterTranslator::SetDefaultsDD_3Levels()
687
689 Teuchos::RCP<std::vector<int> >& /* options */,
690 Teuchos::RCP<std::vector<double> >& /* params */,
691 bool OverWrite) {
692 ParameterList List;
693
694 inList.setName("Maxwell default values");
695 List.set("default values", "maxwell");
696 List.set("max levels", 10);
697 List.set("prec type", "MGV");
698 List.set("increasing or decreasing", "decreasing");
699
700 List.set("aggregation: type", "Uncoupled-MIS");
701 List.set("aggregation: damping factor", 1.333);
702 List.set("eigen-analysis: type", "cg");
703 List.set("eigen-analysis: iterations", 10);
704 // dropping threshold for small entries in edge prolongator
705 List.set("aggregation: edge prolongator drop threshold", 0.0);
706
707 List.set("smoother: sweeps", 1);
708 List.set("smoother: damping factor", 1.0);
709 List.set("smoother: pre or post", "both");
710 List.set("smoother: type", "Hiptmair");
711 List.set("smoother: Hiptmair efficient symmetric", true);
712 List.set("subsmoother: type", "Chebyshev"); // Hiptmair subsmoother options
713 List.set("subsmoother: Chebyshev alpha", 20.0);
714 List.set("subsmoother: node sweeps", 4);
715 List.set("subsmoother: edge sweeps", 4);
716
717 // direct solver on coarse problem
718 List.set("coarse: type", "Amesos-KLU");
719 List.set("coarse: max size", 128);
720 List.set("coarse: pre or post", "post");
721 List.set("coarse: sweeps", 1);
722
723 // Make sure we know this follows the ML defaults
724 List.set("parameterlist: syntax", "ml");
725
726 ML_OverwriteDefaults(inList, List, OverWrite);
727 return 0;
728} // ML2MueLuParameterTranslator::SetDefaultsMaxwell()
729
731 Teuchos::RCP<std::vector<int> >& /* options */,
732 Teuchos::RCP<std::vector<double> >& /* params */,
733 bool OverWrite) {
734 ParameterList List;
735
736 inList.setName("NSSA default values");
737 List.set("default values", "NSSA");
738 List.set("max levels", 10);
739 List.set("prec type", "MGW");
740 List.set("increasing or decreasing", "increasing");
741
742 List.set("aggregation: type", "Uncoupled-MIS");
743 List.set("energy minimization: enable", true);
744 List.set("eigen-analysis: type", "power-method");
745 List.set("eigen-analysis: iterations", 20);
746
747 List.set("smoother: sweeps", 4);
748 List.set("smoother: damping factor", .67);
749 List.set("smoother: pre or post", "post");
750 List.set("smoother: type", "symmetric Gauss-Seidel");
751
752 List.set("coarse: type", "Amesos-KLU");
753 List.set("coarse: max size", 256);
754 List.set("coarse: pre or post", "post");
755 List.set("coarse: sweeps", 1);
756
757 // Make sure we know this follows the ML defaults
758 List.set("parameterlist: syntax", "ml");
759
760 ML_OverwriteDefaults(inList, List, OverWrite);
761 return 0;
762} // ML2MueLuParameterTranslator::SetDefaultsNSSA()
763
765 Teuchos::RCP<std::vector<int> >& options,
766 Teuchos::RCP<std::vector<double> >& params,
767 bool OverWrite) {
768 ParameterList List;
769
770 inList.setName("DD-LU default values");
771 List.set("default values", "DD-LU");
772 List.set("max levels", 2);
773 List.set("prec type", "MGV");
774 List.set("increasing or decreasing", "increasing");
775
776 List.set("aggregation: type", "METIS");
777 List.set("aggregation: local aggregates", 1);
778 List.set("aggregation: damping factor", 1.333);
779 List.set("eigen-analysis: type", "power-method");
780 List.set("eigen-analysis: iterations", 20);
781
782 List.set("smoother: sweeps", 1);
783 List.set("smoother: pre or post", "both");
784
785 /*#ifdef HAVE_ML_AZTECOO
786 List.set("smoother: type","Aztec");
787 (*options)[AZ_precond] = AZ_dom_decomp;
788 (*options)[AZ_subdomain_solve] = AZ_lu;
789 List.set("smoother: Aztec options",options);
790 List.set("smoother: Aztec params",params);
791 List.set("smoother: Aztec as solver",false);
792 #endif*/
793
794 List.set("coarse: type", "Amesos-KLU");
795 List.set("coarse: max size", 128);
796 List.set("coarse: pre or post", "post");
797 List.set("coarse: sweeps", 1);
798
799 // Make sure we know this follows the ML defaults
800 List.set("parameterlist: syntax", "ml");
801
802 ML_OverwriteDefaults(inList, List, OverWrite);
803 return 0;
804} // ML2MueLuParameterTranslator::SetDefaultsDD_LU()
805
807 Teuchos::RCP<std::vector<int> >& options,
808 Teuchos::RCP<std::vector<double> >& params,
809 bool OverWrite) {
810 ParameterList List;
811
812 inList.setName("DD-ML-LU default values");
813 List.set("default values", "DD-ML-LU");
814 List.set("max levels", 3);
815 List.set("prec type", "MGV");
816 List.set("increasing or decreasing", "increasing");
817
818 List.set("aggregation: type", "METIS");
819 List.set("aggregation: nodes per aggregate", 512);
820 List.set("aggregation: next-level aggregates per process", 128);
821 List.set("aggregation: damping factor", 1.333);
822
823 List.set("smoother: sweeps", 1);
824 List.set("smoother: pre or post", "both");
825 /*#ifdef HAVE_ML_AZTECOO
826 List.set("smoother: type","Aztec");
827 (*options)[AZ_precond] = AZ_dom_decomp;
828 (*options)[AZ_subdomain_solve] = AZ_lu;
829 List.set("smoother: Aztec options",options);
830 List.set("smoother: Aztec params",params);
831 List.set("smoother: Aztec as solver",false);
832 #endif*/
833 List.set("coarse: type", "Amesos-KLU");
834 List.set("coarse: max size", 128);
835 List.set("coarse: pre or post", "post");
836 List.set("coarse: sweeps", 1);
837
838 ML_OverwriteDefaults(inList, List, OverWrite);
839 return 0;
840} // ML2MueLuParameterTranslator::SetDefaultsDD_3Levels_LU()
841
843 Teuchos::RCP<std::vector<int> >& /* options */,
844 Teuchos::RCP<std::vector<double> >& /* params */,
845 bool OverWrite) {
846 ParameterList List;
847
848 inList.setName("Classical-AMG default values");
849 List.set("default values", "Classical-AMG");
850 List.set("max levels", 10);
851 List.set("prec type", "MGV");
852 List.set("increasing or decreasing", "increasing");
853 List.set("smoother: sweeps", 2);
854 List.set("smoother: damping factor", 1.0);
855 List.set("smoother: pre or post", "both");
856 List.set("smoother: type", "symmetric Gauss-Seidel");
857
858 List.set("coarse: type", "Amesos-KLU");
859 List.set("coarse: max size", 128);
860 List.set("coarse: pre or post", "post");
861 List.set("coarse: sweeps", 1);
862
863 // Make sure we know this follows the ML defaults
864 List.set("parameterlist: syntax", "ml");
865
866 ML_OverwriteDefaults(inList, List, OverWrite);
867 return 0;
868} // ML2MueLuParameterTranslator::SetDefaultsClassicalAMG()
869
870int ML2MueLuParameterTranslator::SetDefaultsRefMaxwell(Teuchos::ParameterList& inList, bool OverWrite) {
871 /* Sublists */
872 Teuchos::ParameterList ListRF, List11, List11c, List22, dummy;
873 Teuchos::ParameterList& List11_ = inList.sublist("refmaxwell: 11list");
874 Teuchos::ParameterList& List22_ = inList.sublist("refmaxwell: 22list");
875 Teuchos::ParameterList& List11c_ = List11_.sublist("edge matrix free: coarse");
876
877 /* Build Teuchos List: (1,1) coarse */
878 SetDefaults("SA", List11c);
879 List11c.remove("parameterlist: syntax");
880 List11c.set("cycle applications", 1);
881 List11c.set("smoother: type", "Chebyshev");
882 List11c.set("aggregation: threshold", .01);
883 List11c.set("coarse: type", "Amesos-KLU");
884 List11c.set("ML label", "coarse (1,1) block");
885 UpdateList(List11c, List11c_, OverWrite);
886
887 /* Build Teuchos List: (1,1) */
888 SetDefaults("SA", List11);
889 List11.remove("parameterlist: syntax");
890 List11.set("cycle applications", 1);
891 List11.set("aggregation: type", "Uncoupled");
892 List11.set("smoother: sweeps", 0);
893 List11.set("aggregation: damping factor", 0.0);
894 List11.set("edge matrix free: coarse", List11c);
895 List11.set("aggregation: threshold", .01);
896 UpdateList(List11, List11_, OverWrite);
897
898 /* Build Teuchos List: (2,2) */
899 SetDefaults("SA", List22);
900 List22.remove("parameterlist: syntax");
901 List22.set("cycle applications", 1);
902 List22.set("smoother: type", "Chebyshev");
903 List22.set("aggregation: type", "Uncoupled");
904 List22.set("aggregation: threshold", .01);
905 List22.set("coarse: type", "Amesos-KLU");
906 List22.set("ML label", "(2,2) block");
907
908 // This line is commented out due to IFPACK issues
909 // List22.set("smoother: sweeps (level 0)",0);
910 UpdateList(List22, List22_, OverWrite);
911
912 /* Build Teuchos List: Overall */
913 SetDefaults("maxwell", ListRF, 0, 0, false);
914 ListRF.set("smoother: type", "Chebyshev");
915 ListRF.set("smoother: sweeps", 2);
916 ListRF.set("refmaxwell: 11solver", "edge matrix free"); // either "edge matrix free" or "sa"
917 ListRF.set("refmaxwell: 11list", List11);
918 ListRF.set("refmaxwell: 22solver", "multilevel");
919 ListRF.set("refmaxwell: 22list", List22);
920 ListRF.set("refmaxwell: mode", "additive");
921 ListRF.set("default values", "RefMaxwell");
922 ListRF.set("zero starting solution", false);
923
924 // Make sure we know this follows the ML defaults
925 ListRF.set("parameterlist: syntax", "ml");
926
927 UpdateList(ListRF, inList, OverWrite);
928
929 return 0;
930} /*end SetDefaultsRefMaxwell*/
931
932} // 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)