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);
318 if (!paramList.isParameter(
"repartition: put on single proc")) {
319 paramList.set(
"repartition: put on single proc", 5000);
323 if (defaultVals !=
"") {
324 TEUCHOS_TEST_FOR_EXCEPTION(defaultVals !=
"SA" && defaultVals !=
"NSSA" && defaultVals !=
"refmaxwell" && defaultVals !=
"Maxwell",
Exceptions::RuntimeError,
325 "MueLu::ML2MueLuParameterTranslator: only \"SA\", \"NSSA\", \"refmaxwell\" and \"Maxwell\" allowed as options for ML default parameters.");
326 Teuchos::ParameterList ML_defaultlist;
327 if (defaultVals ==
"refmaxwell")
334 paramList = ML_defaultlist;
343 ParameterList paramListWithSubList;
345 paramList = paramListWithSubList;
346 Teuchos::ParameterList adaptingParamList = paramList;
357 if (paramListWithSubList.isParameter(
"aggregation: aux: enable") && paramListWithSubList.get<
bool>(
"aggregation: aux: enable")) {
358 if (paramListWithSubList.isParameter(
"aggregation: aux: threshold")) {
359 paramListWithSubList.set(
"aggregation: threshold", paramListWithSubList.get<
double>(
"aggregation: aux: threshold"));
360 paramListWithSubList.remove(
"aggregation: aux: threshold");
366 std::stringstream mueluss;
368 mueluss <<
"<ParameterList name=\"MueLu\">" << std::endl;
371 mueluss <<
"<Parameter name=\"aggregation: match ML phase1\" type=\"bool\" value=\"true\"/>" << std::endl;
374 mueluss <<
"<Parameter name=\"aggregation: match ML phase2a\" type=\"bool\" value=\"true\"/>" << std::endl;
377 mueluss <<
"<Parameter name=\"aggregation: match ML phase2b\" type=\"bool\" value=\"true\"/>" << std::endl;
380 mueluss <<
"<Parameter name=\"aggregation: use ml scaling of drop tol\" type=\"bool\" value=\"true\"/>" << std::endl;
383 mueluss <<
"<Parameter name=\"sa: diagonal replacement tolerance\" type=\"double\" value=\"0.0\"/>" << std::endl;
387 Teuchos::ParameterList mueluList;
390 for (ParameterList::ConstIterator param = paramListWithSubList.begin(); param != paramListWithSubList.end(); ++param) {
392 const std::string& pname = paramListWithSubList.name(param);
396 if (pname ==
"parameterlist: syntax") {
402 std::stringstream valuess;
403 valuess << paramList.entry(param);
404 std::string valuestr = valuess.str();
407 valuestr =
trim(valuestr);
410 std::string valueInterpreterStr =
"\"" + valuestr +
"\"";
412 bool hasBeenProcessed =
false;
414 if ((pname ==
"aggregation: aux: enable") && (paramListWithSubList.get<
bool>(
"aggregation: aux: enable"))) {
415 mueluss <<
"<Parameter name=\"aggregation: drop scheme\" type=\"string\" value=\""
416 <<
"distance laplacian"
417 <<
"\"/>" << std::endl;
421 if (pname ==
"ML output") {
423 int verbosityLevel = std::stoi(valuestr);
424 std::string eVerbLevel =
"none";
425 if (verbosityLevel == 0) eVerbLevel =
"none";
426 if (verbosityLevel >= 1) eVerbLevel =
"low";
427 if (verbosityLevel >= 5) eVerbLevel =
"medium";
428 if (verbosityLevel >= 10) eVerbLevel =
"high";
429 if (verbosityLevel >= 11) eVerbLevel =
"extreme";
430 if (verbosityLevel >= 42) eVerbLevel =
"test";
431 if (verbosityLevel >= 666) eVerbLevel =
"interfacetest";
432 mueluss <<
"<Parameter name=\"verbosity\" type=\"string\" value=\"" << eVerbLevel <<
"\"/>" << std::endl;
438 mueluss << ret << std::endl;
441 adaptingParamList.remove(pname,
false);
443 hasBeenProcessed =
true;
449 if (pname ==
"energy minimization: enable") {
450 mueluss <<
"<Parameter name=\"problem: symmetric\" type=\"bool\" value=\"false\"/>" << std::endl;
451 mueluss <<
"<Parameter name=\"transpose: use implicit\" type=\"bool\" value=\"false\"/>" << std::endl;
452 hasBeenProcessed =
true;
456 if (pname ==
"smoother: type") {
458 hasBeenProcessed =
true;
462 if (pname.find(
"smoother: list (level", 0) == 0) {
464 std::string type, option;
467 typedef Teuchos::ArrayRCP<char>::size_type size_type;
468 Teuchos::Array<char> ctype(size_type(pname.size() + 1));
469 Teuchos::Array<char> coption(size_type(pname.size() + 1));
471 int matched = sscanf(pname.c_str(),
"%s %[^(](level %d)", ctype.getRawPtr(), coption.getRawPtr(), &levelID);
472 type = std::string(ctype.getRawPtr());
473 option = std::string(coption.getRawPtr());
474 option.resize(option.size() - 1);
476 if (matched != 3 || (type !=
"smoother:")) {
478 <<
"Error in creating level-specific sublists" << std::endl
479 <<
"Offending parameter: " << pname << std::endl);
482 mueluss <<
"<ParameterList name=\"level " << levelID <<
"\">" << std::endl;
483 mueluss <<
GetSmootherFactory(paramList.sublist(pname), adaptingParamList.sublist(pname),
"smoother: type", paramList.sublist(pname).get<std::string>(
"smoother: type"));
484 mueluss <<
"</ParameterList>" << std::endl;
486 hasBeenProcessed =
true;
489 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.");
491 if (pname ==
"coarse: list") {
498 std::string coarse_smoother =
"Amesos-KLU";
499 if (paramList.sublist(
"coarse: list").isParameter(
"smoother: type"))
500 coarse_smoother = paramList.sublist(
"coarse: list").get<std::string>(
"smoother: type");
502 mueluss <<
GetSmootherFactory(paramList.sublist(
"coarse: list"), adaptingParamList.sublist(
"coarse: list"),
"coarse: type", coarse_smoother);
503 hasBeenProcessed =
true;
506 if (pname ==
"aggregation: type") {
507 if (valuestr ==
"Uncoupled")
508 mueluss <<
"<Parameter name=\"aggregation: type\" type=\"string\" value=\"uncoupled\"/>" << std::endl;
509 else if (valuestr ==
"Uncoupled-MIS") {
510 mueluss <<
"<Parameter name=\"aggregation: type\" type=\"string\" value=\"uncoupled\"/>" << std::endl;
511 mueluss <<
"<Parameter name=\"aggregation: coloring algorithm\" type=\"string\" value=\"mis2 aggregation\"/>" << std::endl;
512 mueluss <<
"<Parameter name=\"aggregation: backend\" type=\"string\" value=\"kokkos\"/>" << std::endl;
515 hasBeenProcessed =
true;
518 if (pname ==
"problem: type" ||
519 pname ==
"smoother: sweeps" ||
520 pname ==
"smoother: damping factor" ||
521 pname ==
"smoother: pre or post" ||
522 pname ==
"coarse: max size")
523 hasBeenProcessed =
true;
525 if (paramList.isSublist(pname))
526 hasBeenProcessed =
true;
528 if (!hasBeenProcessed) {
529 std::cout <<
"Could not translate \"" << pname <<
"\" = \"" << valuestr <<
"\"\n";
531 std::cout <<
"Is valid MueLu parameter \"" << pname <<
"\"\n";
532 mueluList.setEntry(pname, paramList.entry(param));
536 mueluss <<
"</ParameterList>" << std::endl;
538 auto translatedList = Teuchos::getParametersFromXmlString(mueluss.str());
540 std::cout <<
"\n\ntranslatedList " << *translatedList << std::endl
541 <<
"muelu list " << mueluList << std::endl
545 for (
auto it = mueluList.begin(); it != mueluList.end(); ++it) {
546 auto& pname = mueluList.name(it);
547 TEUCHOS_TEST_FOR_EXCEPTION(translatedList->isParameter(pname),
MueLu::Exceptions::RuntimeError,
"The parameter \"" << pname <<
"\" has been set both using ML and MueLu parameter names.");
550 translatedList->setParameters(mueluList);
552 return translatedList;
556 ParameterList* coarseList = 0;
558 if (inList.isSublist(
"coarse: list"))
559 coarseList = &(inList.sublist(
"coarse: list"));
560 for (ParameterList::ConstIterator param = List.begin(); param != List.end(); param++) {
561 std::string pname = List.name(param);
562 if (coarseList && pname.find(
"coarse: ", 0) != std::string::npos) {
563 if (!coarseList->isParameter(pname) || OverWrite)
564 coarseList->setEntry(pname, List.entry(param));
565 }
else if (!inList.isParameter(pname) || OverWrite) {
566 inList.setEntry(pname, List.entry(param));
579 int* ioptions,
double* iparams,
const bool OverWrite) {
580 Teuchos::RCP<std::vector<int> > options;
581 Teuchos::RCP<std::vector<double> > params;
584 const int MUELU_AZ_OPTIONS_SIZE = 47;
585 const int MUELU_AZ_PARAMS_SIZE = 30;
591 if (ioptions == NULL)
592 options = rcp(
new std::vector<int>(MUELU_AZ_OPTIONS_SIZE));
594 options = rcp(
new std::vector<int>(ioptions, ioptions + MUELU_AZ_OPTIONS_SIZE));
596 params = rcp(
new std::vector<double>(MUELU_AZ_PARAMS_SIZE));
598 params = rcp(
new std::vector<double>(iparams, iparams + MUELU_AZ_PARAMS_SIZE));
603 if (ProblemType ==
"SA") {
605 }
else if (ProblemType ==
"DD") {
607 }
else if (ProblemType ==
"DD-ML") {
609 }
else if (ProblemType ==
"maxwell" || ProblemType ==
"Maxwell") {
611 }
else if (ProblemType ==
"NSSA") {
613 }
else if (ProblemType ==
"DD-ML-LU") {
615 }
else if (ProblemType ==
"DD-LU") {
617 }
else if (ProblemType ==
"Classical-AMG") {
620 std::cerr <<
"ERROR: Wrong input parameter in `SetDefaults' ("
621 << ProblemType <<
"). Should be: " << std::endl
622 <<
"ERROR: <SA> / <DD> / <DD-ML> / <maxwell>" << std::endl;
929 Teuchos::ParameterList ListRF, List11, List11c, List22, dummy;
930 Teuchos::ParameterList& List11_ = inList.sublist(
"refmaxwell: 11list");
931 Teuchos::ParameterList& List22_ = inList.sublist(
"refmaxwell: 22list");
932 Teuchos::ParameterList& List11c_ = List11_.sublist(
"edge matrix free: coarse");
936 List11c.remove(
"parameterlist: syntax");
937 List11c.set(
"cycle applications", 1);
938 List11c.set(
"smoother: type",
"Chebyshev");
939 List11c.set(
"aggregation: threshold", .01);
940 List11c.set(
"coarse: type",
"Amesos-KLU");
941 List11c.set(
"ML label",
"coarse (1,1) block");
946 List11.remove(
"parameterlist: syntax");
947 List11.set(
"cycle applications", 1);
948 List11.set(
"aggregation: type",
"Uncoupled");
949 List11.set(
"smoother: sweeps", 0);
950 List11.set(
"aggregation: damping factor", 0.0);
951 List11.set(
"edge matrix free: coarse", List11c);
952 List11.set(
"aggregation: threshold", .01);
957 List22.remove(
"parameterlist: syntax");
958 List22.set(
"cycle applications", 1);
959 List22.set(
"smoother: type",
"Chebyshev");
960 List22.set(
"aggregation: type",
"Uncoupled");
961 List22.set(
"aggregation: threshold", .01);
962 List22.set(
"coarse: type",
"Amesos-KLU");
963 List22.set(
"ML label",
"(2,2) block");
971 ListRF.set(
"smoother: type",
"Chebyshev");
972 ListRF.set(
"smoother: sweeps", 2);
973 ListRF.set(
"refmaxwell: 11solver",
"edge matrix free");
974 ListRF.set(
"refmaxwell: 11list", List11);
975 ListRF.set(
"refmaxwell: 22solver",
"multilevel");
976 ListRF.set(
"refmaxwell: 22list", List22);
977 ListRF.set(
"refmaxwell: mode",
"additive");
978 ListRF.set(
"default values",
"RefMaxwell");
979 ListRF.set(
"zero starting solution",
false);
982 ListRF.set(
"parameterlist: syntax",
"ml");