MueLu  Version of the Day
MueLu_ML2MueLuParameterTranslator.cpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // MueLu: A package for multigrid based preconditioning
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 
47 #include "MueLu_ConfigDefs.hpp"
48 #if defined(HAVE_MUELU_ML)
49 # include <ml_config.h>
50 # if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS)
51 # include <ml_ValidateParameters.h>
52 # include <ml_MultiLevelPreconditioner.h> // for default values
53 # include <ml_RefMaxwell.h>
54 # endif
55 #endif
56 
58 
59 namespace MueLu {
60 
61 
62  std::string ML2MueLuParameterTranslator::GetSmootherFactory(const Teuchos::ParameterList& paramList, Teuchos::ParameterList& adaptingParamList, const std::string& pname, const std::string& value) {
63 
64  TEUCHOS_TEST_FOR_EXCEPTION(pname != "coarse: type" && pname != "coarse: list" && pname != "smoother: type" && pname.find("smoother: list",0) != 0,
66  "MueLu::MLParameterListInterpreter::Setup(): Only \"coarse: type\", \"smoother: type\" or \"smoother: list\" (\"coarse: list\") are "
67  "supported as ML parameters for transformation of smoother/solver parameters to MueLu");
68 
69  // string stream containing the smoother/solver xml parameters
70  std::stringstream mueluss;
71 
72  // Check whether we are dealing with coarse level (solver) parameters or level smoother parameters
73  std::string mode = "smoother:";
74  if (pname.find("coarse:", 0) == 0)
75  mode = "coarse:";
76 
77  // check whether pre and/or post smoothing
78  std::string PreOrPost = "both";
79  if (paramList.isParameter(mode + " pre or post"))
80  PreOrPost = paramList.get<std::string>(mode + " pre or post");
81 
82  TEUCHOS_TEST_FOR_EXCEPTION(mode == "coarse:" && PreOrPost != "both", Exceptions::RuntimeError,
83  "MueLu::MLParameterListInterpreter::Setup(): The parameter \"coarse: pre or post\" is not supported by MueLu. "
84  "It does not make sense for direct solvers. For iterative solvers you obtain the same effect by increasing, "
85  "e.g., the number of sweeps for the coarse grid smoother. Please remove it from your parameters.");
86 
87  // select smoother type
88  std::string valuestr = value; // temporary variable
89  std::transform(valuestr.begin(), valuestr.end(), valuestr.begin(), ::tolower);
90  if ( valuestr == "jacobi" || valuestr == "gauss-seidel" || valuestr == "symmetric gauss-seidel" ) {
91  std::string my_name;
92  if ( PreOrPost == "both" ) my_name = "\"" + pname + "\"";
93  else my_name = "\"smoother: " + PreOrPost + " type\"";
94  mueluss << "<Parameter name=" << my_name << " type=\"string\" value=\"RELAXATION\"/>" << std::endl;
95 
96  } else if ( valuestr == "ifpack" ) {
97  std::string my_name = "\"" + pname + "\"";
98  if ( paramList.isParameter("smoother: ifpack type") ) {
99  if ( paramList.get<std::string>("smoother: ifpack type") == "ILU" ) {
100  mueluss << "<Parameter name=" << my_name << " type=\"string\" value=\"ILU\"/>" << std::endl;
101  adaptingParamList.remove("smoother: ifpack type",false);
102  }
103  if ( paramList.get<std::string>("smoother: ifpack type") == "ILUT" ) {
104  mueluss << "<Parameter name=" << my_name << " type\" type=\"string\" value=\"ILUT\"/>" << std::endl;
105  adaptingParamList.remove("smoother: ifpack type",false);
106  }
107  }
108 
109  } else if (( valuestr == "chebyshev" ) || ( valuestr == "mls" )) {
110  std::string my_name = "\"" + pname + "\"";
111  mueluss << "<Parameter name=" << my_name << " type=\"string\" value=\"CHEBYSHEV\"/>" << std::endl;
112 
113  } else if (valuestr.length() > strlen("amesos") && valuestr.substr(0, strlen("amesos")) == "amesos") { /* catch Amesos-* */
114  std::string solverType = valuestr.substr(strlen("amesos")+1); /* ("amesos-klu" -> "klu") */
115 
116  bool valid = false;
117  const int validatorSize = 5;
118  std::string validator[validatorSize] = {"superlu", "superludist", "klu", "umfpack", "mumps"};
119  for (int i=0; i < validatorSize; i++)
120  if (validator[i] == solverType)
121  valid = true;
122  TEUCHOS_TEST_FOR_EXCEPTION(!valid, Exceptions::RuntimeError,
123  "MueLu::MLParameterListInterpreter: unknown smoother type. '" << solverType << "' not supported.");
124 
125  mueluss << "<Parameter name=\"" << pname << "\" type=\"string\" value=\"" << solverType << "\"/>" << std::endl;
126 
127  } else {
128  // TODO error message
129  std::cout << "error in " << __FILE__ << ":" << __LINE__ << " could not find valid smoother/solver" << std::endl;
130  }
131 
132  // set smoother: pre or post parameter
133  // Note that there is no "coarse: pre or post" in MueLu!
134  if ( paramList.isParameter("smoother: pre or post") && mode == "smoother:") {
135  //std::cout << "paramList" << paramList << std::endl;
136  //std::string smootherPreOrPost = paramList.get<std::string>("smoother: pre or post");
137  //std::cout << "Create pre or post parameter with " << smootherPreOrPost << std::endl;
138  mueluss << "<Parameter name=\"smoother: pre or post\" type=\"string\" value=\"" << PreOrPost << "\"/>" << std::endl;
139  adaptingParamList.remove("smoother: pre or post",false);
140  }
141 
142  // create smoother parameter list
143  if (PreOrPost != "both") {
144  mueluss << "<ParameterList name=\"smoother: " << PreOrPost << " params\">" << std::endl;
145  } else {
146  mueluss << "<ParameterList name=\"" << mode << " params\">" << std::endl;
147  }
148 
149  // relaxation based smoothers:
150 
151  if ( valuestr == "jacobi" || valuestr == "gauss-seidel" || valuestr == "symmetric gauss-seidel" ) {
152  if ( valuestr == "jacobi" ) { mueluss << "<Parameter name=\"relaxation: type\" type=\"string\" value=\"Jacobi\"/>" << std::endl; adaptingParamList.remove("relaxation: type",false); }
153  if ( valuestr == "gauss-seidel" ) { mueluss << "<Parameter name=\"relaxation: type\" type=\"string\" value=\"Gauss-Seidel\"/>" << std::endl; adaptingParamList.remove("relaxation: type",false); }
154  if ( valuestr == "symmetric gauss-seidel" ) { mueluss << "<Parameter name=\"relaxation: type\" type=\"string\" value=\"Symmetric Gauss-Seidel\"/>" << std::endl; adaptingParamList.remove("relaxation: type",false); }
155 
156  if ( paramList.isParameter("smoother: sweeps") ) { mueluss << "<Parameter name=\"relaxation: sweeps\" type=\"int\" value=\"" << paramList.get<int>("smoother: sweeps") << "\"/>" << std::endl; adaptingParamList.remove("smoother: sweeps",false); }
157  if ( paramList.isParameter("smoother: damping factor") ) { mueluss << "<Parameter name=\"relaxation: damping factor\" type=\"double\" value=\"" << paramList.get<double>("smoother: damping factor") << "\"/>" << std::endl; adaptingParamList.remove("smoother: damping factor",false); }
158  if ( paramList.isParameter("smoother: use l1 Gauss-Seidel") ) { mueluss << "<Parameter name=\"relaxation: use l1\" type=\"bool\" value=\"" << paramList.get<bool>("smoother: use l1 Gauss-Seidel") << "\"/>" << std::endl; adaptingParamList.remove("smoother: use l1 Gauss-Seidel",false); }
159  }
160 
161  // Chebyshev
162  if ( valuestr == "chebyshev") {
163  if ( paramList.isParameter("smoother: polynomial order") ) { mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<int>("smoother: polynomial order") << "\"/>" << std::endl; adaptingParamList.remove("smoother: polynomial order",false); }
164  else { mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"2\"/>" << std::endl; }
165  if ( paramList.isParameter("smoother: Chebyshev alpha") ) { mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<double>("smoother: Chebyshev alpha") << "\"/>" << std::endl; adaptingParamList.remove("smoother: Chebyshev alpha",false); }
166  else { mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"20\"/>" << std::endl; adaptingParamList.remove("smoother: Chebyshev alpha",false); }
167  if ( paramList.isParameter("eigen-analysis: type") ) { mueluss << "<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"" << paramList.get<std::string>("eigen-analysis: type") << "\"/>" << std::endl; adaptingParamList.remove("eigen-analysis: type",false); }
168  else { mueluss << "<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"cg\"/>" << std::endl; }
169  }
170 
171  // MLS
172  if ( valuestr == "mls") {
173  if ( paramList.isParameter("smoother: MLS polynomial order") ) { mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<int>("smoother: MLS polynomial order") << "\"/>" << std::endl; adaptingParamList.remove("smoother: MLS polynomial order",false); }
174  else if ( paramList.isParameter("smoother: polynomial order") ) { mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"" << paramList.get<int>("smoother: polynomial order") << "\"/>" << std::endl; adaptingParamList.remove("smoother: polynomial order",false); }
175  else { mueluss << "<Parameter name=\"chebyshev: degree\" type=\"int\" value=\"2\"/>" << std::endl; }
176  if ( paramList.isParameter("smoother: MLS alpha") ) { mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<double>("smoother: MLS alpha") << "\"/>" << std::endl; adaptingParamList.remove("smoother: MLS alpha",false); }
177  else if ( paramList.isParameter("smoother: Chebyshev alpha") ) { mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"" << paramList.get<double>("smoother: Chebyshev alpha") << "\"/>" << std::endl; adaptingParamList.remove("smoother: Chebyshev alpha",false); }
178  else { mueluss << "<Parameter name=\"chebyshev: ratio eigenvalue\" type=\"double\" value=\"20\"/>" << std::endl; }
179  if ( paramList.isParameter("eigen-analysis: type") ) { mueluss << "<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"" << paramList.get<std::string>("eigen-analysis: type") << "\"/>" << std::endl; adaptingParamList.remove("eigen-analysis: type",false); }
180  else { mueluss << "<Parameter name=\"eigen-analysis: type\" type=\"string\" value=\"cg\"/>" << std::endl; }
181  }
182 
183  // parameters for ILU based preconditioners
184  if ( valuestr == "ifpack") {
185 
186  // add Ifpack parameters
187  if ( paramList.isParameter("smoother: ifpack overlap") ) { mueluss << "<Parameter name=\"partitioner: overlap\" type=\"int\" value=\"" << paramList.get<int>("smoother: ifpack overlap") << "\"/>" << std::endl; adaptingParamList.remove("smoother: ifpack overlap",false); }
188  if ( paramList.isParameter("smoother: ifpack level-of-fill") ) { mueluss << "<Parameter name=\"fact: level-of-fill\" type=\"int\" value=\"" << paramList.get<int>("smoother: ifpack level-of-fill") << "\"/>" << std::endl; adaptingParamList.remove("smoother: ifpack level-of-fill",false); }
189  if ( paramList.isParameter("smoother: ifpack absolute threshold") ) { mueluss << "<Parameter name=\"fact: absolute threshold\" type=\"int\" value=\"" << paramList.get<double>("smoother: ifpack absolute threshold") << "\"/>" << std::endl; adaptingParamList.remove("smoother: ifpack absolute threshold",false); }
190  if ( paramList.isParameter("smoother: ifpack relative threshold") ) { mueluss << "<Parameter name=\"fact: relative threshold\" type=\"int\" value=\"" << paramList.get<double>("smoother: ifpack relative threshold") << "\"/>" << std::endl; adaptingParamList.remove("smoother: ifpack relative threshold",false); }
191  }
192 
193  mueluss << "</ParameterList>" << std::endl;
194 
195  // max coarse level size parameter (outside of smoother parameter lists)
196  if ( paramList.isParameter("smoother: max size") ) {
197  mueluss << "<Parameter name=\"coarse: max size\" type=\"int\" value=\"" << paramList.get<int>("smoother: max size") << "\"/>" << std::endl; adaptingParamList.remove("smoother: max size",false);
198  }
199 
200  return mueluss.str();
201  }
202 
203  std::string ML2MueLuParameterTranslator::SetParameterList(const Teuchos::ParameterList & paramList_in, const std::string& defaultVals) {
204  Teuchos::ParameterList paramList = paramList_in;
205 
206  RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); // TODO: use internal out (GetOStream())
207 
208 #if defined(HAVE_MUELU_ML) && defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS)
209 
210  // TODO alternative with standard parameterlist from ML user guide?
211 
212  if (defaultVals != "") {
213  TEUCHOS_TEST_FOR_EXCEPTION(defaultVals!="SA" && defaultVals!="NSSA" && defaultVals!="refmaxwell", Exceptions::RuntimeError,
214  "MueLu::MLParameterListInterpreter: only \"SA\", \"NSSA\", and \"refmaxwell\" allowed as options for ML default parameters.");
215  Teuchos::ParameterList ML_defaultlist;
216  if (defaultVals == "refmaxwell")
217  ML_Epetra::SetDefaultsRefMaxwell(ML_defaultlist);
218  else
219  ML_Epetra::SetDefaults(defaultVals,ML_defaultlist);
220 
221  // merge user parameters with default parameters
222  MueLu::MergeParameterList(paramList_in, ML_defaultlist, true);
223  paramList = ML_defaultlist;
224  }
225 #else
226  if (defaultVals != "") {
227  // If no validator available: issue a warning and set parameter value to false in the output list
228  *out << "Warning: MueLu_ENABLE_ML=OFF, ML_ENABLE_Epetra=OFF or ML_ENABLE_TEUCHOS=OFF. No ML default values available." << std::endl;
229  }
230 #endif // HAVE_MUELU_ML && HAVE_ML_EPETRA && HAVE_ML_TEUCHOS
231 
232  //
233  // Move smoothers/aggregation/coarse parameters to sublists
234  //
235 
236  // ML allows to have level-specific smoothers/aggregation/coarse parameters at the top level of the list or/and defined in sublists:
237  // See also: ML Guide section 6.4.1, MueLu::CreateSublists, ML_CreateSublists
238  ParameterList paramListWithSubList;
239  MueLu::CreateSublists(paramList, paramListWithSubList);
240  paramList = paramListWithSubList; // swap
241  Teuchos::ParameterList adaptingParamList = paramList; // copy of paramList which is used to removed already interpreted parameters
242 
243  //
244  // Validate parameter list
245  //
246  {
247  bool validate = paramList.get("ML validate parameter list", true); /* true = default in ML */
248  if (validate && defaultVals!="refmaxwell") {
249 
250 #if defined(HAVE_MUELU_ML) && defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS)
251  // Validate parameter list using ML validator
252  int depth = paramList.get("ML validate depth", 5); /* 5 = default in ML */
253  TEUCHOS_TEST_FOR_EXCEPTION(! ML_Epetra::ValidateMLPParameters(paramList, depth), Exceptions::RuntimeError,
254  "ERROR: ML's Teuchos::ParameterList contains incorrect parameter!");
255 #else
256  // If no validator available: issue a warning and set parameter value to false in the output list
257  *out << "Warning: MueLu_ENABLE_ML=OFF, ML_ENABLE_Epetra=OFF or ML_ENABLE_TEUCHOS=OFF. The parameter list cannot be validated." << std::endl;
258  paramList.set("ML validate parameter list", false);
259 
260 #endif // HAVE_MUELU_ML && HAVE_ML_EPETRA && HAVE_ML_TEUCHOS
261  } // if(validate)
262  } // scope
263 
264  // stringstream for concatenating xml parameter strings.
265  std::stringstream mueluss;
266 
267  // create surrounding MueLu parameter list
268  mueluss << "<ParameterList name=\"MueLu\">" << std::endl;
269 
270  // loop over all ML parameters in provided parameter list
271  for (ParameterList::ConstIterator param = paramListWithSubList.begin(); param != paramListWithSubList.end(); ++param) {
272 
273  // extract ML parameter name
274  const std::string & pname=paramListWithSubList.name(param);
275 
276  // extract corresponding (ML) value
277  // remove ParameterList specific information from result string
278  std::stringstream valuess;
279  valuess << paramList.entry(param);
280  std::string valuestr = valuess.str();
281  replaceAll(valuestr, "[unused]", "");
282  replaceAll(valuestr, "[default]", "");
283  valuestr = trim(valuestr);
284 
285  // transform ML parameter to corresponding MueLu parameter and generate XML string
286  std::string valueInterpreterStr = "\"" + valuestr + "\"";
287  std::string ret = MasterList::interpretParameterName(MasterList::ML2MueLu(pname),valueInterpreterStr);
288 
289  // special handling for verbosity level
290  if (pname == "ML output") {
291  // Translate verbosity parameter
292  int verbosityLevel = std::stoi(valuestr);
293  std::string eVerbLevel = "none";
294  if (verbosityLevel == 0) eVerbLevel = "none";
295  if (verbosityLevel >= 1) eVerbLevel = "low";
296  if (verbosityLevel >= 5) eVerbLevel = "medium";
297  if (verbosityLevel >= 10) eVerbLevel = "high";
298  if (verbosityLevel >= 11) eVerbLevel = "extreme";
299  if (verbosityLevel >= 42) eVerbLevel = "test";
300  if (verbosityLevel >= 666) eVerbLevel = "interfacetest";
301  mueluss << "<Parameter name=\"verbosity\" type=\"string\" value=\"" << eVerbLevel << "\"/>" << std::endl;
302  continue;
303  }
304 
305  // add XML string
306  if (ret != "") {
307  mueluss << ret << std::endl;
308 
309  // remove parameter from ML parameter list
310  adaptingParamList.remove(pname,false);
311  }
312 
313  // special handling for energy minimization
314  // TAW: this is not optimal for symmetric problems but at least works.
315  // for symmetric problems the "energy minimization" parameter should not exist anyway...
316  if (pname == "energy minimization: enable") {
317  mueluss << "<Parameter name=\"problem: symmetric\" type=\"bool\" value=\"false\"/>" << std::endl;
318  mueluss << "<Parameter name=\"transpose: use implicit\" type=\"bool\" value=\"false\"/>" << std::endl;
319  }
320 
321  // special handling for smoothers
322  if (pname == "smoother: type") {
323 
324  mueluss << GetSmootherFactory(paramList, adaptingParamList, pname, valuestr);
325 
326  }
327 
328  // special handling for level-specific smoothers
329  if (pname.find("smoother: list (level",0) == 0) {
330  // Scan pname (ex: pname="smoother: type (level 2)")
331  std::string type, option;
332  int levelID=-1;
333  {
334  typedef Teuchos::ArrayRCP<char>::size_type size_type;
335  Teuchos::Array<char> ctype (size_type(pname.size()+1));
336  Teuchos::Array<char> coption(size_type(pname.size()+1));
337 
338  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")
339  type = std::string(ctype.getRawPtr());
340  option = std::string(coption.getRawPtr()); option.resize(option.size () - 1); // remove final white-space
341 
342  if (matched != 3 || (type != "smoother:")) {
343  TEUCHOS_TEST_FOR_EXCEPTION(true, MueLu::Exceptions::RuntimeError, "MueLu::CreateSublist(), Line " << __LINE__ << ". "
344  << "Error in creating level-specific sublists" << std::endl
345  << "Offending parameter: " << pname << std::endl);
346  }
347 
348  mueluss << "<ParameterList name=\"level " << levelID << "\">" << std::endl;
349  mueluss << GetSmootherFactory(paramList.sublist(pname),adaptingParamList.sublist(pname), "smoother: type", paramList.sublist(pname).get<std::string>("smoother: type"));
350  mueluss << "</ParameterList>" << std::endl;
351  }
352  }
353 
354  // special handling for coarse level
355  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.");
356  if ( pname == "coarse: list" ) {
357 
358  // interpret smoother/coarse solver data.
359  // Note, that we inspect the "coarse: list" sublist to define the "coarse" smoother/solver
360  // Be aware, that MueLu::CreateSublists renames the prefix of the parameters in the "coarse: list" from "coarse" to "smoother".
361  // Therefore, we have to check the values of the "smoother" parameters
362  TEUCHOS_TEST_FOR_EXCEPTION(!paramList.sublist("coarse: list").isParameter("smoother: type"), Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter::Setup(): no coarse grid solver defined.");
363  mueluss << GetSmootherFactory(paramList.sublist("coarse: list"), adaptingParamList.sublist("coarse: list"), "coarse: type", paramList.sublist("coarse: list").get<std::string>("smoother: type"));
364 
365 
366  }
367  } // for
368 
369  mueluss << "</ParameterList>" << std::endl;
370 
371  return mueluss.str();
372  }
373 
374 
375 } // namespace MueLu
static std::string SetParameterList(const Teuchos::ParameterList &paramList_in, const std::string &defaultVals)
: Interpret parameter list
void MergeParameterList(const Teuchos::ParameterList &source, Teuchos::ParameterList &dest, bool overWrite)
: merge two parameter lists
static std::string interpretParameterName(const std::string &name, const std::string &value)
std::string tolower(const std::string &str)
Namespace for MueLu classes and methods.
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 ...
void CreateSublists(const ParameterList &List, ParameterList &newList)
static std::string ML2MueLu(const std::string &name)
Translate ML parameter to corresponding MueLu parameter.
Exception throws to report errors in the internal logical of the program.
void replaceAll(std::string &str, const std::string &from, const std::string &to)