Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utilities/rocflu/post/main.C File Reference
#include <iostream>
#include <vector>
#include <list>
#include <sstream>
#include "clop.H"
Include dependency graph for utilities/rocflu/post/main.C:

Go to the source code of this file.

Functions

void RFLUPOST (const char *, const char *, int *, long int, long int)
 
void Usage (const string &pn)
 
int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 51 of file utilities/rocflu/post/main.C.

References AddOp(), GetOp(), RFLUPOST(), stripdir(), Usage(), and Vectize().

52 {
53  // Get the commandline into a string vector - it's easier
54  // to deal with that way.
55  vector<string> args = Vectize((const char **)argv,argc);
56 
57  // Get the name of the executable by stripping off any leading
58  // directory names
59  string program_name(stripdir(args[0]));
60 
61  // Specify the allowable options to the program
62  AddOp("casename",'c');
63  AddOp("verbosity",'v');
64  AddOp("help",'h');
65  AddOp("stamp",'s');
66 
67  // Declare some variables for command line argument handling
68  string casename;
69  string sverb;
70  string stamp;
71  int verbosity;
72  bool help;
73  bool isset;
74 
75  // See if the help option is specified, if so give'm the usage text
76  if(help = GetOp("help",args)){
77  Usage(program_name);
78  exit(0);
79  }
80 
81  // Process casename option, if it's not set then fail
82  if(GetOp("casename",casename,args)){
83  if(casename.empty()){ // casename was empty
84  cerr << program_name
85  << ": Expected casename after casename option."
86  << " Use -h for usage instructions."
87  << endl;
88  exit(1);
89  }
90  }
91  else{ // option not specified (but it's required!)
92  cerr << program_name
93  << ": Missing required casename option."
94  << " Use -h for usage instructions."
95  << endl;
96  exit(1);
97  }
98 
99  // Process stamp option, if it's not set then fail
100  if(GetOp("stamp",stamp,args)){
101  if(casename.empty()){ // stamp was empty
102  cerr << program_name
103  << ": Expected stamp after stamp option."
104  << " Use -h for usage instructions."
105  << endl;
106  exit(1);
107  }
108  }
109  else{ // option not specified (but it's required!)
110  cerr << program_name
111  << ": Missing required stamp option."
112  << " Use -h for usage instructions."
113  << endl;
114  exit(1);
115  }
116 
117  // Process verbosity option
118  if(GetOp("verbosity",sverb,args)){
119  if(sverb.empty()){
120  cerr << program_name
121  << ": Expected verbosity level. "
122  << "Use -h for usage instructions." << endl;
123  exit(1);
124  }
125  istringstream Istr(sverb);
126  Istr >> verbosity;
127  if(verbosity < 0 || verbosity > 2){ // Some jerk specified a non numeric or negative
128  cerr << program_name
129  << ": Invalid verbosity value. Use -h for usage "
130  << "instructions." << endl;
131  exit(1);
132  }
133  }
134  else{ // Default verbosity
135  verbosity = 1;
136  }
137 
138  RFLUPOST(casename.c_str(),stamp.c_str(),&verbosity,casename.length(),stamp.length());
139 }
const string stripdir(const string &)
void RFLUPOST(const char *, const char *, int *, long int, long int)
bool GetOp(const string &ops, const vector< string > &args)
void AddOp(const string &lo, const char &so)
void Usage(const string &pn)
vector< string > Vectize(const char **)
Definition: clop.C:182

Here is the call graph for this function:

void RFLUPOST ( const char *  ,
const char *  ,
int *  ,
long  int,
long  int 
)

Referenced by main().

Here is the caller graph for this function:

void Usage ( const string &  pn)

Definition at line 37 of file utilities/rocflu/post/main.C.

38 {
39  cout << endl << "Usage: " << pn << " -c <casename> -s <stamp> [-v 0-2]"
40  << endl << endl
41  << " -c | --casename : Specifies the casename" << endl
42  << " -s | --stamp : Iteration or time stamp" << endl
43  << " -v | --verbosity : Verbosity level:" << endl
44  << " 0 - Quiet" << endl
45  << " 1 - Moderately verbose" << endl
46  << " 2 - Ridiculously verbose" << endl
47  << endl;
48 }