68 Usage(
const string &pn)
70 cout << endl <<
"Usage: " << pn <<
" -c <casename> -r <n> -p <m> [-v 0-2]" << endl << endl
71 <<
" -c | --casename : Specifies the casename" << endl
72 <<
" -m | --mode : Mapping mode:" << endl
73 <<
" 1 - Initial mapping" << endl
74 <<
" 2 - Final mapping" << endl
75 <<
" -r | --nregions : Specifies the number of regions" << endl
76 <<
" -p | --nprocs : Specifies the number of processes" << endl
77 <<
" -v | --verbosity : Verbosity level:" << endl
78 <<
" 0 - Quiet" << endl
79 <<
" 1 - Moderately verbose" << endl
80 <<
" 2 - Ridiculously verbose" << endl
85 main(
int argc,
char *argv[])
89 vector<string> args =
Vectize((
const char **)argv,argc);
93 string program_name(
stripdir(args[0]));
96 AddOp(
"casename",
'c');
98 AddOp(
"nregions",
'r');
100 AddOp(
"verbosity",
'v');
105 string smode,sprocs,sregs,sverb;
114 if(help =
GetOp(
"help",args)){
120 if(
GetOp(
"casename",casename,args)){
121 if(casename.empty()){
123 <<
": Expected casename after casename option."
124 <<
" Use -h for usage instructions."
131 <<
": Missing required casename option."
132 <<
" Use -h for usage instructions."
138 if(
GetOp(
"mode",smode,args)){
141 <<
": Expected mode value. "
142 <<
"Use -h for usage instructions." << endl;
145 istringstream Istr(smode);
147 if(mode < 1 || mode > 2){
149 <<
": Invalid mode value. Use -h for usage "
150 <<
"instructions." << endl;
156 <<
": Missing mode value."
157 <<
" Use -h for usage instructions."
163 if(
GetOp(
"nregions",sregs,args)){
166 <<
": Expected number of regions. "
167 <<
"Use -h for usage instructions." << endl;
170 istringstream Istr(sregs);
174 <<
": Invalid number of regions. Use -h for usage "
175 <<
"instructions." << endl;
182 <<
": Missing number of regions."
183 <<
" Use -h for usage instructions."
193 if(
GetOp(
"nprocs",sprocs,args)){
196 <<
": Expected number of processes. "
197 <<
"Use -h for usage instructions." << endl;
200 istringstream Istr(sprocs);
204 <<
": Invalid number of processes. Use -h for usage "
205 <<
"instructions." << endl;
208 if(nprocs > nregions){
210 <<
": Number of processes must not exceed number of regions." << endl;
217 <<
": Missing number of processes."
218 <<
" Use -h for usage instructions."
228 if(
GetOp(
"verbosity",sverb,args)){
231 <<
": Expected verbosity level. "
232 <<
"Use -h for usage instructions." << endl;
235 istringstream Istr(sverb);
237 if(verbosity < 0 || verbosity > 2){
239 <<
": Invalid verbosity value. Use -h for usage "
240 <<
"instructions." << endl;
const string stripdir(const string &)
bool GetOp(const string &ops, const vector< string > &args)
void AddOp(const string &lo, const char &so)
void Usage(const string &pn)
int main(int argc, char *argv[])
subroutine rflumap(caseString, mapOption, nRegions, nProcs, verbLevel)
#define FC_GLOBAL(name, NAME)
vector< string > Vectize(const char **)