9 import xml.etree.ElementTree
as ET
11 outfile = open(
"parameters.dox",
"w")
14 outfile.write(
"/*! \\page z2_parameters Zoltan2 Parameters\n\n")
15 outfile.write(
"This page lists each Zoltan2 parameter and how to use it. The validators\n")
16 outfile.write(
"are classes of interest to Zoltan2 developers. They are used to evaluate\n")
17 outfile.write(
"the validity of parameter values at run time.\n\n")
23 desc = pinfo.get(
"docString")
26 step = pval.get(
"step")
28 outfile.write(
"- \\b "+pname+
" \\anchor "+pname+
"\n")
29 outfile.write(
" - Description: "+desc+
"\n")
30 outfile.write(
" - Valid values:\n")
31 outfile.write(
" - minimum is "+min+
"\n")
32 outfile.write(
" - maximum is "+max+
"\n")
33 outfile.write(
" - step is "+step+
"\n")
34 outfile.write(
" - Validator type: Teuchos::EnhancedNumberValidator\n")
38 desc = pinfo.get(
"docString")
39 unsorted = pval.get(
"unsorted")
42 if "min" in pinfo.keys():
44 if "max" in pinfo.keys():
47 outfile.write(
"- \\b "+pname+
" \\anchor "+pname+
"\n")
48 outfile.write(
" - Description: "+desc+
"\n")
49 outfile.write(
" - Valid values: a comma-separated list of\n")
50 outfile.write(
" - numbers\n")
51 outfile.write(
" - number ranges separated by a dash (\"1-5\")\n")
52 outfile.write(
" - the word \"all\" to indicate all possible values\n")
54 outfile.write(
" - minimum is: "+min+
"\n")
56 outfile.write(
" - maximum is: "+max+
"\n")
58 outfile.write(
" - Examples: \"1,2,7\", \"all\", \"5,1-15,80-82,99\"\n")
59 outfile.write(
" - Validator type: Zoltan2::IntegerRangeListValidator\n")
60 if unsorted ==
"true":
61 outfile.write(
"(list is not changed during processing)\n")
63 outfile.write(
"(list will be sorted, and duplicates removed, during processing)\n")
68 desc = pinfo.get(
"docString")
69 outfile.write(
"- \\b "+pname+
" \\anchor "+pname+
"\n")
70 outfile.write(
" - Description: "+desc+
"\n")
71 outfile.write(
" - Validator type: Teuchos::FileNameValidator\n")
75 desc = pinfo.get(
"docString")
77 if pval.get(
"allowDouble") ==
"true":
78 validTypes.append(
"double")
79 if pval.get(
"allowInt") ==
"true":
80 validTypes.append(
"int")
81 if pval.get(
"allowString") ==
"true":
82 validTypes.append(
"string")
84 outfile.write(
"- \\b "+pname+
" \\anchor "+pname+
"\n")
85 outfile.write(
" - Description: "+desc+
"\n")
86 outfile.write(
" - Valid values are any values of type:\n")
87 for vtype
in validTypes:
88 outfile.write(
" \\li "+vtype+
"\n")
89 outfile.write(
" - Validator type: Teuchos::AnyNumberParameterEntryValidator\n")
93 desc = pinfo.get(
"docString")
94 outfile.write(
"- \\b "+pname+
" \\anchor "+pname+
"\n")
95 outfile.write(
" - Description: "+desc+
"\n")
96 outfile.write(
" - Valid values:\n")
98 if node.tag ==
"String":
99 svalue = node.get(
"stringValue")
101 if "stringDoc" in node.keys():
102 sdoc = node.get(
"stringDoc")
104 outfile.write(
" \\li \\e "+svalue+
"\n")
106 outfile.write(
" \\li \\e "+svalue+
" "+sdoc+
"\n")
107 outfile.write(
" - Validator type: Teuchos::StringToIntegralParameterEntryValidator\n")
111 desc = pinfo.get(
"docString")
112 mustExist = pinfo.get(
"fileMustExist")
113 outfile.write(
"- \\b "+pname+
" \\anchor "+pname+
"\n")
114 outfile.write(
" - Description: "+desc+
"\n")
115 if mustExist ==
"true":
116 outfile.write(
" File must exist.\n")
118 outfile.write(
" File need not already exist.\n")
119 outfile.write(
" - Validator type: Teuchos::FileNameValidator\n")
123 desc = pinfo.get(
"docString")
124 outfile.write(
"- \\b "+pname+
" \\anchor "+pname+
"\n")
125 outfile.write(
" - Description: "+desc+
"\n")
126 outfile.write(
" - Valid values:\n")
128 if node.tag ==
"String":
129 outfile.write(
" \\li \\e "+node.get(
"value")+
"\n")
130 outfile.write(
" - Validator type: Teuchos::StringValidator\n")
138 pvalidatorType = pval.get(
"type")
140 if pvalidatorType ==
"anynumberValidator":
143 elif pvalidatorType ==
"FilenameValidator":
146 elif pvalidatorType ==
"StringValidator":
149 elif "StringIntegralValidator" in pvalidatorType:
152 elif "IntegerRangeListValidator" in pvalidatorType:
155 elif "EnhancedNumberValidator" in pvalidatorType:
159 print "Error 4: This is not a valid Zoltan2 parameter list."
166 tree = ET.parse(
"../data/parameters.xml")
168 root = tree.getroot()
170 if root.tag !=
"ParameterList":
171 print "Error 1: This is not a valid Zoltan2 parameter list."
176 if node.tag ==
"Validators":
180 if len(validators) == 0:
181 print "Error 1: This is not a valid Zoltan2 parameter list."
188 for node
in validators:
189 id = node.get(
"validatorId")
200 if node.tag !=
"Parameter":
202 id = node.get(
"validatorId")
203 if id
not in vals.keys():
204 print "Error 3: This is not a valid Zoltan2 parameter list."
207 paramName = node.get(
"name")
209 parameterInfo.append((paramName, node, vals[id]))
217 for info
in sorted(set(parameterInfo)):
218 print "Parameter: ",info[0]
def parameterIntegerRangeList
def parameterDocumentationHeader
def parameterDocumentationFooter
def parameterStringToIntegral
def parameterEnhancedNumber