38 const string &pname = List.
name(param);
40 if ((pname.find(
" (level", 0) == string::npos || pname.find(
"smoother: list (level", 0) == 0 || pname.find(
"aggregation: list (level", 0) == 0) &&
41 (pname.find(
"coarse: ", 0) == string::npos)) {
51 const string &pname = coarseList.
name(param);
53 if (pname.find(
"coarse:", 0) == 0) {
55 newCoarseList.
setEntry(
"smoother: " + pname.substr(8), coarseList.
entry(param));
64 const string &pname = List.
name(param);
65 if (pname.find(
" (level", 0) != string::npos && pname.find(
"smoother: list (level", 0) != 0 && pname.find(
"aggregation: list (level", 0) != 0) {
76 int matched = sscanf(pname.c_str(),
"%s %[^(](level %d)", ctype.
getRawPtr(), coption.
getRawPtr(), &levelID);
79 option.resize(option.size() - 1);
81 if (matched != 3 || (type !=
"smoother:" && type !=
"aggregation:")) {
83 <<
"Error in creating level-specific sublists" << std::endl
84 <<
"Offending parameter: " << pname << std::endl);
93 }
else if (pname.find(
"coarse:", 0) == 0 && pname !=
"coarse: list") {
96 newCoarseList.
setEntry(
"smoother: " + pname.substr(8), List.
entry(param));
108 sprintf(levelChar,
"(level %d)", levelID);
109 std::string levelStr(levelChar);
111 if (paramList.
isSublist(type +
": list " + levelStr)) {
112 return paramList.
sublist(type +
": list " + levelStr);
114 return emptyParamList;
124 const std::string &pname = paramList.
name(param);
125 if (pname.find(str +
":", 0) == 0 && !entry.
isList()) {
134 void replaceAll(std::string &str,
const std::string &from,
const std::string &to) {
137 size_t start_pos = 0;
138 while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
139 str.replace(start_pos, from.length(), to);
140 start_pos += to.length();
const std::string & name() const
void MergeParameterList(const Teuchos::ParameterList &source, Teuchos::ParameterList &dest, bool overWrite)
: merge two parameter lists
ParameterList & setEntry(const std::string &name, U &&entry)
ConstIterator end() const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
const Teuchos::ParameterList & GetMLSubList(const Teuchos::ParameterList ¶mList, const std::string &type, int levelID)
bool isParameter(const std::string &name) const
void CreateSublists(const ParameterList &List, ParameterList &newList)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool isSublist(const std::string &name) const
Teuchos::RCP< Teuchos::ParameterList > ExtractSetOfParameters(const Teuchos::ParameterList ¶mList, const std::string &str)
params_t::ConstIterator ConstIterator
ConstIterator begin() const
const ParameterEntry & entry(ConstIterator i) const
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
ParameterList & setName(const std::string &name)
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)
std::string toString(const T &t)