77 const string & pname=List.
name(param);
79 if ((pname.find(
" (level",0) == string::npos || pname.find(
"smoother: list (level",0) == 0 || pname.find(
"aggregation: list (level",0) == 0) &&
80 (pname.find(
"coarse: ",0) == string::npos))
91 const string & pname=coarseList.
name(param);
93 if (pname.find(
"coarse:",0) == 0) {
95 newCoarseList.
setEntry(
"smoother: "+pname.substr(8),coarseList.
entry(param));
105 const string & pname=List.
name(param);
106 if (pname.find(
" (level",0) != string::npos && pname.find(
"smoother: list (level",0) != 0 && pname.find(
"aggregation: list (level",0) != 0)
118 int matched = sscanf(pname.c_str(),
"%s %[^(](level %d)", ctype.
getRawPtr(), coption.
getRawPtr(), &levelID);
120 option = string(coption.
getRawPtr()); option.resize(option.size () - 1);
122 if (matched != 3 || (type !=
"smoother:" && type !=
"aggregation:")) {
124 <<
"Error in creating level-specific sublists" << std::endl
125 <<
"Offending parameter: " << pname << std::endl);
134 }
else if (pname.find(
"coarse:",0) == 0 && pname !=
"coarse: list") {
137 newCoarseList.
setEntry(
"smoother: "+pname.substr(8),List.
entry(param));
149 sprintf(levelChar,
"(level %d)", levelID);
150 std::string levelStr(levelChar);
152 if (paramList.
isSublist(type +
": list " + levelStr)) {
153 return paramList.
sublist(type +
": list " + levelStr);
155 return emptyParamList;
165 const std::string & pname = paramList.
name(param);
166 if (pname.find(str+
":",0) == 0 && !entry.
isList()) {
175 void replaceAll(std::string& str,
const std::string& from,
const std::string& to) {
178 size_t start_pos = 0;
179 while((start_pos = str.find(from, start_pos)) != std::string::npos) {
180 str.replace(start_pos, from.length(), to);
181 start_pos += to.length();
const std::string & name() const
void MergeParameterList(const Teuchos::ParameterList &source, Teuchos::ParameterList &dest, bool overWrite)
: merge two parameter lists
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)
ParameterList & setEntry(const std::string &name, const ParameterEntry &entry)
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)