53 #include <Teuchos_StringInputSource.hpp> 54 #include <Teuchos_XMLParser.hpp> 55 #include <Teuchos_XMLObject.hpp> 56 #include <Teuchos_XMLParameterListReader.hpp> 57 #include <Teuchos_ValidatorXMLConverterDB.hpp> 82 RCP<const irl_t> intRangeValidatorP = rcp(
new irl_t);
83 RCP<irlConverter_t > converter = rcp(
new irlConverter_t);
84 Teuchos::ValidatorXMLConverterDB::addConverter(
92 Teuchos::StringInputSource src(xmlParameterString);
94 Teuchos::XMLObject xmlObj;
95 std::ostringstream errMsg;
97 Teuchos::XMLParser parser(src.stream());
100 xmlObj = parser.parse();
102 catch (std::exception &e){
103 errMsg << e.what() <<
" invalid xml";
106 if (errMsg.str().size() == 0){
108 Teuchos::XMLParameterListReader rdr;
109 pList = rdr.toParameterList(xmlObj);
111 catch (std::exception &e){
112 errMsg << e.what() <<
" invalid parameter list";
116 if (errMsg.str().size() > 0)
117 throw std::logic_error(errMsg.str().c_str());
144 const Teuchos::ParameterList &plSome,
145 const Teuchos::ParameterList &plAll,
146 Teuchos::ParameterList &plVal)
148 ParameterList::ConstIterator next = plSome.begin();
150 while (next != plSome.end()){
152 const std::string &name = next->first;
153 const ParameterEntry &entrySome = plSome.getEntry(name);
154 const ParameterEntry &entryAll = plAll.getEntry(name);
156 if (entrySome.isList()){
161 plVal.setEntry(name, entryAll);
175 const Teuchos::ParameterList &plIn,
176 Teuchos::ParameterList &plOut)
178 ParameterList allParameters;
191 const Teuchos::ParameterList &pl,
193 std::string listNames)
196 if (listNames.size() == 0)
197 listNames = std::string(
"top");
199 Array<std::string> subLists;
200 ParameterList::ConstIterator next = pl.begin();
202 while (next != pl.end()){
203 const std::string &name = next->first;
204 const ParameterEntry &entry = pl.getEntry(name);
207 subLists.append(name);
210 std::string doc = entry.docString();
211 os <<
"List: "<< listNames <<
", parameter: " << name <<
"\n";
219 for (
int i=0; i < subLists.size(); i++){
220 std::string newListName = listNames + std::string(
"/") + subLists[i];
221 const ParameterList &sublist = pl.sublist(subLists[i]);
#define ZOLTAN2_XML_PARAMETER_STRING
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
Defines Parameter related enumerators, declares functions.
XML conversion code for IntegerRangeListValidator.
void createValidatorList(const Teuchos::ParameterList &plIn, Teuchos::ParameterList &plOut)
Create a list by adding validators to the users parameter list.
void createAllParameters(Teuchos::ParameterList &pList)
Create a list of all Zoltan2 parameters and validators.
void printListDocumentation(const Teuchos::ParameterList &pl, std::ostream &os, std::string listNames)
A ParameterList validator for integer range lists.
Define IntegerRangeList validator.
static void setValidatorsInList(const Teuchos::ParameterList &plSome, const Teuchos::ParameterList &plAll, Teuchos::ParameterList &plVal)
Create a parameter list that can validate a specific list of parameters.