48 #include <Zoltan2_config.h>
51 #include <Teuchos_ParameterList.hpp>
52 #include <Teuchos_DefaultComm.hpp>
53 #include <Teuchos_Array.hpp>
54 #include <Teuchos_ParameterEntryValidator.hpp>
58 int main(
int narg,
char *arg[])
60 Tpetra::ScopeGuard tscope(&narg, &arg);
61 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
63 int rank = comm->getRank();
70 Teuchos::ParameterList validParameters;
72 Teuchos::ParameterList myParams(
"testParameterList");
74 myParams.set(
"debug_level",
"detailed_status");
75 myParams.set(
"debug_procs",
"all");
76 myParams.set(
"debug_output_stream",
"std::cout");
78 myParams.set(
"timer_output_file",
"appPerformance.txt");
88 myParams.validateParametersAndSetDefaults(validParameters);
91 catch(std::exception &e){
92 std::cerr <<
"Validate parameters generated an error:" << std::endl;
93 std::cerr << e.what() << std::endl;
94 std::cerr <<
"FAIL" << std::endl;
98 validParameters = Teuchos::ParameterList();
100 std::cout << std::endl;
101 std::cout <<
"A few parameters after validation: " << std::endl;
102 std::cout << myParams << std::endl;
105 std::cout <<
"debug_procs translation: ";
107 std::cout << std::endl;
112 Teuchos::ParameterList faultyParams(
"badParameterList");
113 faultyParams.set(
"debug_procs",
"not-even-remotely-an-integer-range");
117 faultyParams.validateParametersAndSetDefaults(validParameters);
119 catch(std::exception &e){
120 std::cout << std::endl;
121 std::cout <<
"Invalid parameter correctly generated an error:" << std::endl;
122 std::cout << e.what() << std::endl;
126 validParameters = Teuchos::ParameterList();
129 std::cerr <<
"Bad parameter was not detected in parameter list." << std::endl;
135 Teuchos::ParameterList all(
"setAllParametersList");
136 all.set(
"debug_level",
"basic_status");
138 all.set(
"debug_procs",
"1,2,5-10,2");
139 all.set(
"memory_procs",
"1,2,3,4,all");
141 all.set(
"debug_output_stream",
"std::cerr");
142 all.set(
"timer_output_stream",
"std::cout");
143 all.set(
"memory_output_stream",
"/dev/null");
146 all.set(
"debug_output_file",
"/home/me/debug.txt");
147 all.set(
"timer_output_file",
"/home/me/performance.txt");
148 all.set(
"memory_output_file",
"/home/me/memoryUsed.txt");
150 all.set(
"error_check_level",
"basic_assertions");
152 all.set(
"partitioning_objective",
"minimize_cut_edge_weight");
154 all.set(
"imbalance_tolerance", 1.2);
156 all.set(
"num_global_parts", 12);
157 all.set(
"num_local_parts", 2);
159 all.set(
"partitioning_approach",
"partition");
161 all.set(
"objects_to_partition",
"graph_vertices");
163 all.set(
"model",
"hypergraph");
165 all.set(
"algorithm",
"phg");
167 all.set(
"symmetrize_input",
"no");
168 all.set(
"subset_graph",
false);
172 all.validateParametersAndSetDefaults(validParameters);
175 catch(std::exception &e){
176 std::cerr <<
"Validate parameters generated an error:" << std::endl;
177 std::cerr << e.what() << std::endl;
178 std::cerr <<
"FAIL" << std::endl;
182 std::cout << std::endl;
183 std::cout <<
"All parameters validated and modified: ";
184 std::cout << all << std::endl;
187 std::cout <<
"debug_procs translation: ";
189 std::cout << std::endl;
192 std::cout <<
"memory_procs translation: ";
194 std::cout << std::endl;
198 std::cout << std::endl;
199 std::cout <<
"Parameter documentation:" << std::endl;
202 std::cout <<
"PASS" << std::endl;
void createValidatorList(const Teuchos::ParameterList &plIn, Teuchos::ParameterList &plOut)
Create a list by adding validators to the users parameter list.
static void convertStringToInt(Teuchos::ParameterList ¶ms)
Convert parameters of type Teuchos::StringToIntegralParameterEntryValidator<int> to integer...
int main(int narg, char *arg[])
void printListDocumentation(const Teuchos::ParameterList &pl, std::ostream &os, std::string listNames)
Teuchos::Array< int > rangeList_t
Define IntegerRangeList validator.
Defines the Environment class.
void printIntegralRangeList(std::ostream &os, Teuchos::Array< Integral > &irl)
A helper function that prints the meaning of an encoded integer range list.