20 TEUCHOS_TEST_FOR_EXCEPTION(pname !=
"coarse: type" && pname !=
"coarse: list" && pname !=
"smoother: type" && pname.find(
"smoother: list", 0) != 0,
22 "MueLu::MLParameterListInterpreter::Setup(): Only \"coarse: type\", \"smoother: type\" or \"smoother: list\" (\"coarse: list\") are "
23 "supported as ML parameters for transformation of smoother/solver parameters to MueLu");
26 std::stringstream mueluss;
29 std::string mode =
"smoother:";
30 bool is_coarse =
false;
31 if (pname.find(
"coarse:", 0) == 0) {
38 if (paramList.isParameter(mode +
" pre or post"))
39 PreOrPost = paramList.get<std::string>(mode +
" pre or post");
42 "MueLu::MLParameterListInterpreter::Setup(): The parameter \"coarse: pre or post\" is not supported by MueLu. "
43 "It does not make sense for direct solvers. For iterative solvers you obtain the same effect by increasing, "
44 "e.g., the number of sweeps for the coarse grid smoother. Please remove it from your parameters.");
47 std::string valuestr = value;
48 std::transform(valuestr.begin(), valuestr.end(), valuestr.begin(), ::tolower);
49 if (valuestr ==
"jacobi" || valuestr ==
"gauss-seidel" || valuestr ==
"symmetric gauss-seidel") {
52 my_name =
"\"" + pname +
"\"";
54 my_name =
"\"smoother: " +
PreOrPost +
" type\"";
55 mueluss <<
"<Parameter name=" << my_name <<
" type=\"string\" value=\"RELAXATION\"/>" << std::endl;
57 }
else if (valuestr ==
"hiptmair") {
60 my_name =
"\"" + pname +
"\"";
62 my_name =
"\"smoother: " +
PreOrPost +
" type\"";
63 mueluss <<
"<Parameter name=" << my_name <<
" type=\"string\" value=\"HIPTMAIR\"/>" << std::endl;
65 }
else if (valuestr ==
"ifpack") {
66 std::string my_name =
"\"" + pname +
"\"";
67 if (paramList.isParameter(
"smoother: ifpack type")) {
68 if (paramList.get<std::string>(
"smoother: ifpack type") ==
"ILU") {
69 mueluss <<
"<Parameter name=" << my_name <<
" type=\"string\" value=\"ILU\"/>" << std::endl;
70 adaptingParamList.remove(
"smoother: ifpack type",
false);
72 if (paramList.get<std::string>(
"smoother: ifpack type") ==
"ILUT") {
73 mueluss <<
"<Parameter name=" << my_name <<
" type\" type=\"string\" value=\"ILUT\"/>" << std::endl;
74 adaptingParamList.remove(
"smoother: ifpack type",
false);
78 }
else if ((valuestr ==
"chebyshev") || (valuestr ==
"mls")) {
79 std::string my_name =
"\"" + pname +
"\"";
80 mueluss <<
"<Parameter name=" << my_name <<
" type=\"string\" value=\"CHEBYSHEV\"/>" << std::endl;
82 }
else if (valuestr.length() > strlen(
"amesos") && valuestr.substr(0, strlen(
"amesos")) ==
"amesos") {
83 std::string solverType = valuestr.substr(strlen(
"amesos") + 1);
86 const int validatorSize = 5;
87 std::string validator[validatorSize] = {
"superlu",
"superludist",
"klu",
"umfpack",
"mumps"};
88 for (
int i = 0; i < validatorSize; i++)
89 if (validator[i] == solverType)
92 "MueLu::MLParameterListInterpreter: unknown smoother type. '" << solverType <<
"' not supported.");
94 mueluss <<
"<Parameter name=\"" << pname <<
"\" type=\"string\" value=\"" << solverType <<
"\"/>" << std::endl;
97 std::cout <<
"error in " << __FILE__ <<
":" << __LINE__ <<
" could not find valid smoother/solver: " << valuestr << std::endl;
102 if (paramList.isParameter(
"smoother: pre or post") && mode ==
"smoother:") {
106 mueluss <<
"<Parameter name=\"smoother: pre or post\" type=\"string\" value=\"" <<
PreOrPost <<
"\"/>" << std::endl;
107 adaptingParamList.remove(
"smoother: pre or post",
false);
112 mueluss <<
"<ParameterList name=\"smoother: " <<
PreOrPost <<
" params\">" << std::endl;
114 mueluss <<
"<ParameterList name=\"" << mode <<
" params\">" << std::endl;
119 if (valuestr ==
"jacobi" || valuestr ==
"gauss-seidel" || valuestr ==
"symmetric gauss-seidel") {
120 if (valuestr ==
"jacobi") {
121 mueluss <<
"<Parameter name=\"relaxation: type\" type=\"string\" value=\"Jacobi\"/>" << std::endl;
122 adaptingParamList.remove(
"relaxation: type",
false);
124 if (valuestr ==
"gauss-seidel") {
125 mueluss <<
"<Parameter name=\"relaxation: type\" type=\"string\" value=\"Gauss-Seidel\"/>" << std::endl;
126 adaptingParamList.remove(
"relaxation: type",
false);
128 if (valuestr ==
"symmetric gauss-seidel") {
129 mueluss <<
"<Parameter name=\"relaxation: type\" type=\"string\" value=\"Symmetric Gauss-Seidel\"/>" << std::endl;
130 adaptingParamList.remove(
"relaxation: type",
false);
132 if (paramList.isParameter(
"smoother: sweeps")) {
133 mueluss <<
"<Parameter name=\"relaxation: sweeps\" type=\"int\" value=\"" << paramList.get<
int>(
"smoother: sweeps") <<
"\"/>" << std::endl;
134 adaptingParamList.remove(
"smoother: sweeps",
false);
136 if (paramList.isParameter(
"smoother: damping factor")) {
137 mueluss <<
"<Parameter name=\"relaxation: damping factor\" type=\"double\" value=\"" << paramList.get<
double>(
"smoother: damping factor") <<
"\"/>" << std::endl;
138 adaptingParamList.remove(
"smoother: damping factor",
false);
140 if (paramList.isParameter(
"smoother: use l1 Gauss-Seidel")) {
141 mueluss <<
"<Parameter name=\"relaxation: use l1\" type=\"bool\" value=\"" << paramList.get<
bool>(
"smoother: use l1 Gauss-Seidel") <<
"\"/>" << std::endl;
142 adaptingParamList.remove(
"smoother: use l1 Gauss-Seidel",
false);
147 if (valuestr ==
"chebyshev") {
148 if (paramList.isParameter(
"smoother: polynomial order")) {
149 mueluss <<
"<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<
int>(
"smoother: polynomial order") <<
"\"/>" << std::endl;
150 adaptingParamList.remove(
"smoother: polynomial order",
false);
152 mueluss <<
"<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"2\"/>" << std::endl;
154 if (paramList.isParameter(
"smoother: Chebyshev alpha")) {
155 mueluss <<
"<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<
double>(
"smoother: Chebyshev alpha") <<
"\"/>" << std::endl;
156 adaptingParamList.remove(
"smoother: Chebyshev alpha",
false);
158 mueluss <<
"<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"20\"/>" << std::endl;
159 adaptingParamList.remove(
"smoother: Chebyshev alpha",
false);
161 if (paramList.isParameter(
"eigen-analysis: type")) {
162 mueluss <<
"<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"" << paramList.get<std::string>(
"eigen-analysis: type") <<
"\"/>" << std::endl;
163 adaptingParamList.remove(
"eigen-analysis: type",
false);
165 mueluss <<
"<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"cg\"/>" << std::endl;
170 if (valuestr ==
"mls") {
171 if (paramList.isParameter(
"smoother: MLS polynomial order")) {
172 mueluss <<
"<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<
int>(
"smoother: MLS polynomial order") <<
"\"/>" << std::endl;
173 adaptingParamList.remove(
"smoother: MLS polynomial order",
false);
174 }
else if (paramList.isParameter(
"smoother: polynomial order")) {
175 mueluss <<
"<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<
int>(
"smoother: polynomial order") <<
"\"/>" << std::endl;
176 adaptingParamList.remove(
"smoother: polynomial order",
false);
178 mueluss <<
"<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"2\"/>" << std::endl;
180 if (paramList.isParameter(
"smoother: MLS alpha")) {
181 mueluss <<
"<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<
double>(
"smoother: MLS alpha") <<
"\"/>" << std::endl;
182 adaptingParamList.remove(
"smoother: MLS alpha",
false);
183 }
else if (paramList.isParameter(
"smoother: Chebyshev alpha")) {
184 mueluss <<
"<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<
double>(
"smoother: Chebyshev alpha") <<
"\"/>" << std::endl;
185 adaptingParamList.remove(
"smoother: Chebyshev alpha",
false);
187 mueluss <<
"<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"20\"/>" << std::endl;
189 if (paramList.isParameter(
"eigen-analysis: type")) {
190 mueluss <<
"<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"" << paramList.get<std::string>(
"eigen-analysis: type") <<
"\"/>" << std::endl;
191 adaptingParamList.remove(
"eigen-analysis: type",
false);
193 mueluss <<
"<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"cg\"/>" << std::endl;
197 if (valuestr ==
"hiptmair") {
198 std::string subSmootherType =
"Chebyshev";
199 if (!is_coarse && paramList.isParameter(
"subsmoother: type"))
200 subSmootherType = paramList.get<std::string>(
"subsmoother: type");
201 if (is_coarse && paramList.isParameter(
"smoother: subsmoother type"))
202 subSmootherType = paramList.get<std::string>(
"smoother: subsmoother type");
204 std::string subSmootherIfpackType;
206 if (subSmootherType ==
"Chebyshev")
207 subSmootherIfpackType =
"CHEBYSHEV";
208 else if (subSmootherType ==
"Jacobi" || subSmootherType ==
"Gauss-Seidel" || subSmootherType ==
"symmetric Gauss-Seidel") {
209 if (subSmootherType ==
"symmetric Gauss-Seidel") subSmootherType =
"Symmetric Gauss-Seidel";
210 subSmootherIfpackType =
"RELAXATION";
212 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::MLParameterListTranslator: unknown smoother type. '" << subSmootherType <<
"' not supported by MueLu.");
214 mueluss <<
"<Parameter name=\"hiptmair: smoother type 1\" type=\"string\" value=\"" << subSmootherIfpackType <<
"\"/>" << std::endl;
215 mueluss <<
"<Parameter name=\"hiptmair: smoother type 2\" type=\"string\" value=\"" << subSmootherIfpackType <<
"\"/>" << std::endl;
217 mueluss <<
"<ParameterList name=\"hiptmair: smoother list 1\">" << std::endl;
218 if (subSmootherType ==
"Chebyshev") {
219 std::string edge_sweeps = is_coarse ?
"smoother: edge sweeps" :
"subsmoother: edge sweeps";
220 std::string cheby_alpha = is_coarse ?
"smoother: Chebyshev alpha" :
"subsmoother: Chebyshev alpha";
222 if (paramList.isParameter(edge_sweeps)) {
223 mueluss <<
"<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<
int>(edge_sweeps) <<
"\"/>" << std::endl;
224 adaptingParamList.remove(
"subsmoother: edge sweeps",
false);
226 if (paramList.isParameter(cheby_alpha)) {
227 mueluss <<
"<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<
double>(cheby_alpha) <<
"\"/>" << std::endl;
230 std::string edge_sweeps = is_coarse ?
"smoother: edge sweeps" :
"subsmoother: edge sweeps";
231 std::string SGS_damping = is_coarse ?
"smoother: SGS damping factor" :
"subsmoother: SGS damping factor";
233 if (paramList.isParameter(edge_sweeps)) {
234 mueluss <<
"<Parameter name=\"relaxation: type\" type=\"string\" value=\"" << subSmootherType <<
"\"/>" << std::endl;
235 mueluss <<
"<Parameter name=\"relaxation: sweeps\" type=\"int\" value=\"" << paramList.get<
int>(edge_sweeps) <<
"\"/>" << std::endl;
236 adaptingParamList.remove(edge_sweeps,
false);
238 if (paramList.isParameter(SGS_damping)) {
239 mueluss <<
"<Parameter name=\"relaxation: damping factor\" type=\"double\" value=\"" << paramList.get<
double>(SGS_damping) <<
"\"/>" << std::endl;
242 mueluss <<
"</ParameterList>" << std::endl;
244 mueluss <<
"<ParameterList name=\"hiptmair: smoother list 2\">" << std::endl;
245 if (subSmootherType ==
"Chebyshev") {
246 std::string node_sweeps = is_coarse ?
"smoother: node sweeps" :
"subsmoother: node sweeps";
247 std::string cheby_alpha = is_coarse ?
"smoother: Chebyshev alpha" :
"subsmoother: Chebyshev alpha";
248 if (paramList.isParameter(node_sweeps)) {
249 mueluss <<
"<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<
int>(node_sweeps) <<
"\"/>" << std::endl;
250 adaptingParamList.remove(
"subsmoother: node sweeps",
false);
252 if (paramList.isParameter(cheby_alpha)) {
253 mueluss <<
"<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<
double>(cheby_alpha) <<
"\"/>" << std::endl;
254 adaptingParamList.remove(
"subsmoother: Chebyshev alpha",
false);
257 std::string node_sweeps = is_coarse ?
"smoother: node sweeps" :
"subsmoother: node sweeps";
258 std::string SGS_damping = is_coarse ?
"smoother: SGS damping factor" :
"subsmoother: SGS damping factor";
260 if (paramList.isParameter(node_sweeps)) {
261 mueluss <<
"<Parameter name=\"relaxation: type\" type=\"string\" value=\"" << subSmootherType <<
"\"/>" << std::endl;
262 mueluss <<
"<Parameter name=\"relaxation: sweeps\" type=\"int\" value=\"" << paramList.get<
int>(node_sweeps) <<
"\"/>" << std::endl;
263 adaptingParamList.remove(
"subsmoother: node sweeps",
false);
265 if (paramList.isParameter(SGS_damping)) {
266 mueluss <<
"<Parameter name=\"relaxation: damping factor\" type=\"double\" value=\"" << paramList.get<
double>(SGS_damping) <<
"\"/>" << std::endl;
267 adaptingParamList.remove(
"subsmoother: SGS damping factor",
false);
270 mueluss <<
"</ParameterList>" << std::endl;
274 if (valuestr ==
"ifpack") {
276 if (paramList.isParameter(
"smoother: ifpack overlap")) {
277 mueluss <<
"<Parameter name=\"partitioner: overlap\" type=\"int\" value=\"" << paramList.get<
int>(
"smoother: ifpack overlap") <<
"\"/>" << std::endl;
278 adaptingParamList.remove(
"smoother: ifpack overlap",
false);
280 if (paramList.isParameter(
"smoother: ifpack level-of-fill")) {
281 mueluss <<
"<Parameter name=\"fact: level-of-fill\" type=\"int\" value=\"" << paramList.get<
int>(
"smoother: ifpack level-of-fill") <<
"\"/>" << std::endl;
282 adaptingParamList.remove(
"smoother: ifpack level-of-fill",
false);
284 if (paramList.isParameter(
"smoother: ifpack absolute threshold")) {
285 mueluss <<
"<Parameter name=\"fact: absolute threshold\" type=\"int\" value=\"" << paramList.get<
double>(
"smoother: ifpack absolute threshold") <<
"\"/>" << std::endl;
286 adaptingParamList.remove(
"smoother: ifpack absolute threshold",
false);
288 if (paramList.isParameter(
"smoother: ifpack relative threshold")) {
289 mueluss <<
"<Parameter name=\"fact: relative threshold\" type=\"int\" value=\"" << paramList.get<
double>(
"smoother: ifpack relative threshold") <<
"\"/>" << std::endl;
290 adaptingParamList.remove(
"smoother: ifpack relative threshold",
false);
294 mueluss <<
"</ParameterList>" << std::endl;
297 if (paramList.isParameter(
"smoother: max size")) {
298 mueluss <<
"<Parameter name=\"coarse: max size\" type=\"int\" value=\"" << paramList.get<
int>(
"smoother: max size") <<
"\"/>" << std::endl;
299 adaptingParamList.remove(
"smoother: max size",
false);
302 return mueluss.str();
306 Teuchos::ParameterList paramList = paramList_in;
308 RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
311 if (paramList.isParameter(
"repartition: start level")) {
312 paramList.set(
"repartition: start level", paramList.get<
int>(
"repartition: start level") + 1);
314 paramList.set(
"repartition: start level", 2);
316 paramList.set(
"repartition: partitioner",
"zoltan");
319 if (!paramList.isParameter(
"repartition: put on single proc")) {
320 paramList.set(
"repartition: put on single proc", 5000);
324 if (defaultVals !=
"") {
325 TEUCHOS_TEST_FOR_EXCEPTION(defaultVals !=
"SA" && defaultVals !=
"NSSA" && defaultVals !=
"refmaxwell" && defaultVals !=
"Maxwell",
Exceptions::RuntimeError,
326 "MueLu::ML2MueLuParameterTranslator: only \"SA\", \"NSSA\", \"refmaxwell\" and \"Maxwell\" allowed as options for ML default parameters.");
327 Teuchos::ParameterList ML_defaultlist;
328 if (defaultVals ==
"refmaxwell")
335 paramList = ML_defaultlist;
344 ParameterList paramListWithSubList;
346 paramList = paramListWithSubList;
347 Teuchos::ParameterList adaptingParamList = paramList;
358 if (paramListWithSubList.isParameter(
"aggregation: aux: enable") && paramListWithSubList.get<
bool>(
"aggregation: aux: enable")) {
359 if (paramListWithSubList.isParameter(
"aggregation: aux: threshold")) {
360 paramListWithSubList.set(
"aggregation: threshold", paramListWithSubList.get<
double>(
"aggregation: aux: threshold"));
361 paramListWithSubList.remove(
"aggregation: aux: threshold");
367 std::stringstream mueluss;
369 mueluss <<
"<ParameterList name=\"MueLu\">" << std::endl;
372 mueluss <<
"<Parameter name=\"aggregation: match ML phase1\" type=\"bool\" value=\"true\"/>" << std::endl;
375 mueluss <<
"<Parameter name=\"aggregation: match ML phase2a\" type=\"bool\" value=\"true\"/>" << std::endl;
378 mueluss <<
"<Parameter name=\"aggregation: match ML phase2b\" type=\"bool\" value=\"true\"/>" << std::endl;
381 mueluss <<
"<Parameter name=\"aggregation: use ml scaling of drop tol\" type=\"bool\" value=\"true\"/>" << std::endl;
384 mueluss <<
"<Parameter name=\"sa: diagonal replacement tolerance\" type=\"double\" value=\"0.0\"/>" << std::endl;
388 Teuchos::ParameterList mueluList;
391 for (ParameterList::ConstIterator param = paramListWithSubList.begin(); param != paramListWithSubList.end(); ++param) {
393 const std::string& pname = paramListWithSubList.name(param);
397 if (pname ==
"parameterlist: syntax") {
403 std::stringstream valuess;
404 valuess << paramList.entry(param);
405 std::string valuestr = valuess.str();
408 valuestr =
trim(valuestr);
411 std::string valueInterpreterStr =
"\"" + valuestr +
"\"";
413 bool hasBeenProcessed =
false;
415 if ((pname ==
"aggregation: aux: enable") && (paramListWithSubList.get<
bool>(
"aggregation: aux: enable"))) {
416 mueluss <<
"<Parameter name=\"aggregation: drop scheme\" type=\"string\" value=\""
417 <<
"distance laplacian"
418 <<
"\"/>" << std::endl;
422 if (pname ==
"ML output") {
424 int verbosityLevel = std::stoi(valuestr);
425 std::string eVerbLevel =
"none";
426 if (verbosityLevel == 0) eVerbLevel =
"none";
427 if (verbosityLevel >= 1) eVerbLevel =
"low";
428 if (verbosityLevel >= 5) eVerbLevel =
"medium";
429 if (verbosityLevel >= 10) eVerbLevel =
"high";
430 if (verbosityLevel >= 11) eVerbLevel =
"extreme";
431 if (verbosityLevel >= 42) eVerbLevel =
"test";
432 if (verbosityLevel >= 666) eVerbLevel =
"interfacetest";
433 mueluss <<
"<Parameter name=\"verbosity\" type=\"string\" value=\"" << eVerbLevel <<
"\"/>" << std::endl;
439 mueluss << ret << std::endl;
442 adaptingParamList.remove(pname,
false);
444 hasBeenProcessed =
true;
450 if (pname ==
"energy minimization: enable") {
451 mueluss <<
"<Parameter name=\"problem: symmetric\" type=\"bool\" value=\"false\"/>" << std::endl;
452 mueluss <<
"<Parameter name=\"transpose: use implicit\" type=\"bool\" value=\"false\"/>" << std::endl;
453 hasBeenProcessed =
true;
457 if (pname ==
"smoother: type") {
459 hasBeenProcessed =
true;
463 if (pname.find(
"smoother: list (level", 0) == 0) {
465 std::string type, option;
468 typedef Teuchos::ArrayRCP<char>::size_type size_type;
469 Teuchos::Array<char> ctype(size_type(pname.size() + 1));
470 Teuchos::Array<char> coption(size_type(pname.size() + 1));
472 int matched = sscanf(pname.c_str(),
"%s %[^(](level %d)", ctype.getRawPtr(), coption.getRawPtr(), &levelID);
473 type = std::string(ctype.getRawPtr());
474 option = std::string(coption.getRawPtr());
475 option.resize(option.size() - 1);
477 if (matched != 3 || (type !=
"smoother:")) {
479 <<
"Error in creating level-specific sublists" << std::endl
480 <<
"Offending parameter: " << pname << std::endl);
483 mueluss <<
"<ParameterList name=\"level " << levelID <<
"\">" << std::endl;
484 mueluss <<
GetSmootherFactory(paramList.sublist(pname), adaptingParamList.sublist(pname),
"smoother: type", paramList.sublist(pname).get<std::string>(
"smoother: type"));
485 mueluss <<
"</ParameterList>" << std::endl;
487 hasBeenProcessed =
true;
490 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.");
492 if (pname ==
"coarse: list") {
499 std::string coarse_smoother =
"Amesos-KLU";
500 if (paramList.sublist(
"coarse: list").isParameter(
"smoother: type"))
501 coarse_smoother = paramList.sublist(
"coarse: list").get<std::string>(
"smoother: type");
503 mueluss <<
GetSmootherFactory(paramList.sublist(
"coarse: list"), adaptingParamList.sublist(
"coarse: list"),
"coarse: type", coarse_smoother);
504 hasBeenProcessed =
true;
507 if (pname ==
"aggregation: type") {
508 if (valuestr ==
"Uncoupled" || valuestr ==
"Uncoupled-MIS") {
509 mueluss <<
"<Parameter name=\"aggregation: type\" type=\"string\" value=\"uncoupled\"/>" << std::endl;
510 mueluss <<
"<Parameter name=\"aggregation: backend\" type=\"string\" value=\"host\"/>" << std::endl;
513 hasBeenProcessed =
true;
516 if (pname ==
"default values" ||
517 pname ==
"problem: type" ||
518 pname ==
"smoother: sweeps" ||
519 pname ==
"smoother: damping factor" ||
520 pname ==
"smoother: pre or post" ||
521 pname ==
"smoother: ifpack type" ||
522 pname ==
"smoother: Chebyshev alpha" ||
523 pname ==
"smoother: use l1 Gauss-Seidel" ||
524 pname ==
"smoother: Gauss-Seidel efficient symmetric" ||
525 pname ==
"smoother: Hiptmair efficient symmetric" ||
526 pname ==
"subsmoother: node sweeps" ||
527 pname ==
"subsmoother: edge sweeps" ||
528 pname ==
"subsmoother: type" ||
529 pname ==
"subsmoother: Chebyshev alpha" ||
530 pname ==
"coarse: max size" ||
531 pname ==
"x-coordinates" ||
532 pname ==
"y-coordinates" ||
533 pname ==
"z-coordinates" ||
534 pname ==
"node: x-coordinates" ||
535 pname ==
"node: y-coordinates" ||
536 pname ==
"node: z-coordinates" ||
537 pname ==
"repartition: partitioner" ||
538 pname ==
"eigen-analysis: type" ||
539 pname ==
"increasing or decreasing"
541 hasBeenProcessed =
true;
543 if (paramList.isSublist(pname))
544 hasBeenProcessed =
true;
546 if (!hasBeenProcessed) {
548 mueluList.setEntry(pname, paramList.entry(param));
552 mueluss <<
"</ParameterList>" << std::endl;
554 auto translatedList = Teuchos::getParametersFromXmlString(mueluss.str());
557 for (
auto it = mueluList.begin(); it != mueluList.end(); ++it) {
558 auto& pname = mueluList.name(it);
559 TEUCHOS_TEST_FOR_EXCEPTION(translatedList->isParameter(pname),
MueLu::Exceptions::RuntimeError,
"The parameter \"" << pname <<
"\" has been set both using ML and MueLu parameter names.");
562 translatedList->setParameters(mueluList);
564 if (defaultVals ==
"Maxwell") {
569 Teuchos::RCP<Teuchos::ParameterList> newList = Teuchos::rcp(
new Teuchos::ParameterList());
572 newList->sublist(
"maxwell1: 22list") = *translatedList;
575 if (newList->sublist(
"maxwell1: 22list").isType<std::string>(
"verbosity")) {
576 newList->set(
"verbosity", newList->sublist(
"maxwell1: 22list").get<std::string>(
"verbosity"));
577 newList->sublist(
"maxwell1: 11list").set(
"verbosity", newList->sublist(
"maxwell1: 22list").get<std::string>(
"verbosity"));
581 newList->sublist(
"maxwell1: 22list").set(
"use kokkos refactor",
false);
582 newList->sublist(
"maxwell1: 22list").set(
"tentative: constant column sums",
false);
583 newList->sublist(
"maxwell1: 22list").set(
"tentative: calculate qr",
false);
585 newList->sublist(
"maxwell1: 11list").set(
"use kokkos refactor",
false);
586 newList->sublist(
"maxwell1: 11list").set(
"multigrid algorithm",
"smoothed reitzinger");
587 newList->sublist(
"maxwell1: 11list").set(
"aggregation: type",
"uncoupled");
591 newList->sublist(
"maxwell1: 11list").set(
"sa: use edge matrix for smoothing",
true);
594 newList->sublist(
"maxwell1: 22list").set(
"aggregation: use ml scaling of drop tol",
true);
595 newList->sublist(
"maxwell1: 22list").set(
"aggregation: min agg size", 3);
598 if (newList->sublist(
"maxwell1: 22list").isType<
double>(
"sa: damping factor")) {
599 newList->sublist(
"maxwell1: 11list").set(
"sa: damping factor", newList->sublist(
"maxwell1: 22list").get<
double>(
"sa: damping factor"));
600 newList->sublist(
"maxwell1: 22list").remove(
"sa: damping factor");
602 newList->sublist(
"maxwell1: 22list").set(
"multigrid algorithm",
"unsmoothed");
603 newList->sublist(
"maxwell1: 22list").set(
"aggregation: type",
"uncoupled");
606 std::vector<std::string> convert = {
"coarse:",
"smoother:",
"smoother: pre",
"smoother: post"};
607 for (
auto it = convert.begin(); it != convert.end(); ++it) {
608 if (newList->sublist(
"maxwell1: 22list").isType<std::string>(*it +
" type")) {
609 newList->sublist(
"maxwell1: 11list").set(*it +
" type", newList->sublist(
"maxwell1: 22list").get<std::string>(*it +
" type"));
610 newList->sublist(
"maxwell1: 22list").remove(*it +
" type");
612 if (newList->sublist(
"maxwell1: 22list").isSublist(*it +
" params")) {
613 newList->sublist(
"maxwell1: 11list").set(*it +
" params", newList->sublist(
"maxwell1: 22list").sublist(*it +
" params"));
614 newList->sublist(
"maxwell1: 22list").remove(*it +
" params");
617 if (newList->sublist(
"maxwell1: 22list").isType<std::string>(
"cycle type")) {
618 newList->sublist(
"maxwell1: 11list").set(
"cycle type", newList->sublist(
"maxwell1: 22list").get<std::string>(
"cycle type"));
619 newList->sublist(
"maxwell1: 22list").remove(
"cycle type");
621 if (newList->sublist(
"maxwell1: 22list").isType<std::string>(
"smoother: pre or post")) {
622 newList->sublist(
"maxwell1: 11list").set(
"smoother: pre or post", newList->sublist(
"maxwell1: 22list").get<std::string>(
"smoother: pre or post"));
623 newList->sublist(
"maxwell1: 22list").remove(
"smoother: pre or post");
626 newList->sublist(
"maxwell1: 22list").set(
"smoother: type",
"none");
627 newList->sublist(
"maxwell1: 22list").set(
"coarse: type",
"none");
629 newList->set(
"maxwell1: nodal smoother fix zero diagonal threshold", 1e-10);
630 newList->sublist(
"maxwell1: 22list").set(
"rap: fix zero diagonals",
true);
631 newList->sublist(
"maxwell1: 22list").set(
"rap: fix zero diagonals threshold", 1e-10);
636 return translatedList;
640 ParameterList* coarseList = 0;
642 if (inList.isSublist(
"coarse: list"))
643 coarseList = &(inList.sublist(
"coarse: list"));
644 for (ParameterList::ConstIterator param = List.begin(); param != List.end(); param++) {
645 std::string pname = List.name(param);
646 if (coarseList && pname.find(
"coarse: ", 0) != std::string::npos) {
647 if (!coarseList->isParameter(pname) || OverWrite)
648 coarseList->setEntry(pname, List.entry(param));
649 }
else if (!inList.isParameter(pname) || OverWrite) {
650 inList.setEntry(pname, List.entry(param));
663 int* ioptions,
double* iparams,
const bool OverWrite) {
664 Teuchos::RCP<std::vector<int> > options;
665 Teuchos::RCP<std::vector<double> > params;
668 const int MUELU_AZ_OPTIONS_SIZE = 47;
669 const int MUELU_AZ_PARAMS_SIZE = 30;
675 if (ioptions == NULL)
676 options = rcp(
new std::vector<int>(MUELU_AZ_OPTIONS_SIZE));
678 options = rcp(
new std::vector<int>(ioptions, ioptions + MUELU_AZ_OPTIONS_SIZE));
680 params = rcp(
new std::vector<double>(MUELU_AZ_PARAMS_SIZE));
682 params = rcp(
new std::vector<double>(iparams, iparams + MUELU_AZ_PARAMS_SIZE));
687 if (ProblemType ==
"SA") {
689 }
else if (ProblemType ==
"DD") {
691 }
else if (ProblemType ==
"DD-ML") {
693 }
else if (ProblemType ==
"maxwell" || ProblemType ==
"Maxwell") {
695 }
else if (ProblemType ==
"NSSA") {
697 }
else if (ProblemType ==
"DD-ML-LU") {
699 }
else if (ProblemType ==
"DD-LU") {
701 }
else if (ProblemType ==
"Classical-AMG") {
704 std::cerr <<
"ERROR: Wrong input parameter in `SetDefaults' ("
705 << ProblemType <<
"). Should be: " << std::endl
706 <<
"ERROR: <SA> / <DD> / <DD-ML> / <maxwell>" << std::endl;
1013 Teuchos::ParameterList ListRF, List11, List11c, List22, dummy;
1014 Teuchos::ParameterList& List11_ = inList.sublist(
"refmaxwell: 11list");
1015 Teuchos::ParameterList& List22_ = inList.sublist(
"refmaxwell: 22list");
1016 Teuchos::ParameterList& List11c_ = List11_.sublist(
"edge matrix free: coarse");
1020 List11c.remove(
"parameterlist: syntax");
1021 List11c.set(
"cycle applications", 1);
1022 List11c.set(
"smoother: type",
"Chebyshev");
1023 List11c.set(
"aggregation: threshold", .01);
1024 List11c.set(
"coarse: type",
"Amesos-KLU");
1025 List11c.set(
"ML label",
"coarse (1,1) block");
1030 List11.remove(
"parameterlist: syntax");
1031 List11.set(
"cycle applications", 1);
1032 List11.set(
"aggregation: type",
"Uncoupled");
1033 List11.set(
"smoother: sweeps", 0);
1034 List11.set(
"aggregation: damping factor", 0.0);
1035 List11.set(
"edge matrix free: coarse", List11c);
1036 List11.set(
"aggregation: threshold", .01);
1041 List22.remove(
"parameterlist: syntax");
1042 List22.set(
"cycle applications", 1);
1043 List22.set(
"smoother: type",
"Chebyshev");
1044 List22.set(
"aggregation: type",
"Uncoupled");
1045 List22.set(
"aggregation: threshold", .01);
1046 List22.set(
"coarse: type",
"Amesos-KLU");
1047 List22.set(
"ML label",
"(2,2) block");
1055 ListRF.set(
"smoother: type",
"Chebyshev");
1056 ListRF.set(
"smoother: sweeps", 2);
1057 ListRF.set(
"refmaxwell: 11solver",
"edge matrix free");
1058 ListRF.set(
"refmaxwell: 11list", List11);
1059 ListRF.set(
"refmaxwell: 22solver",
"multilevel");
1060 ListRF.set(
"refmaxwell: 22list", List22);
1061 ListRF.set(
"refmaxwell: mode",
"additive");
1062 ListRF.set(
"default values",
"RefMaxwell");
1063 ListRF.set(
"zero starting solution",
false);
1066 ListRF.set(
"parameterlist: syntax",
"ml");