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

Go to the source code of this file.

Functions

void FC_GLOBAL (rflupart, RFLUPART) const
 
int main (int argc, char *argv[])
 

Function Documentation

void FC_GLOBAL ( rflupart  ,
RFLUPART   
) const

Definition at line 64 of file utilities/rocflu/part/main.C.

69 {
70  cout << endl << "Usage: " << pn << " -c <casename> [-v 0-2]" << endl << endl
71  << " -c | --casename : Specifies the casename" << endl
72  << " -v | --verbosity : Verbosity level:" << endl
73  << " 0 - Quiet" << endl
74  << " 1 - Moderately verbose" << endl
75  << " 2 - Ridiculously verbose" << endl
76  << " 3 - Exteremly verbose" << endl
77  << endl;
78 }
int main ( int  argc,
char *  argv[] 
)

Definition at line 81 of file utilities/rocflu/part/main.C.

References AddOp(), FC_GLOBAL, GetOp(), rflupart(), RFLUPART, stripdir(), Usage(), and Vectize().

82 {
83  // Get the commandline into a string vector - it's easier
84  // to deal with that way.
85  vector<string> args = Vectize((const char **)argv,argc);
86 
87  // Get the name of the executable by stripping off any leading
88  // directory names
89  string program_name(stripdir(args[0]));
90 
91  // Specify the allowable options to the program
92  AddOp("casename",'c');
93  AddOp("verbosity",'v');
94  AddOp("help",'h');
95 
96  // Declare some variables for command line argument handling
97  string casename;
98  string sverb;
99  int verbosity;
100  bool help;
101  bool isset;
102 
103  // See if the help option is specified, if so give'm the usage text
104  if(help = GetOp("help",args)){
105  Usage(program_name);
106  exit(0);
107  }
108 
109  // Process casename option, if it's not set then fail
110  if(GetOp("casename",casename,args)){
111  if(casename.empty()){ // casename was empty
112  cerr << program_name
113  << ": Expected casename after casename option."
114  << " Use -h for usage instructions."
115  << endl;
116  exit(1);
117  }
118  }
119  else{ // option not specified (but it's required!)
120  cerr << program_name
121  << ": Missing required casename option."
122  << " Use -h for usage instructions."
123  << endl;
124  exit(1);
125  }
126 
127  // Process verbosity option
128  if(GetOp("verbosity",sverb,args)){
129  if(sverb.empty()){
130  cerr << program_name
131  << ": Expected verbosity level. "
132  << "Use -h for usage instructions." << endl;
133  exit(1);
134  }
135  istringstream Istr(sverb);
136  Istr >> verbosity;
137  if(verbosity < 0 || verbosity > 4){ // Some jerk specified a non numeric or negative
138  cerr << program_name
139  << ": Invalid verbosity value. Use -h for usage "
140  << "instructions." << endl;
141  exit(1);
142  }
143  }
144  else{ // Default verbosity
145  verbosity = 1;
146  }
147 
148  FC_GLOBAL(rflupart,RFLUPART)(casename.c_str(),&verbosity,casename.length());
149 }
const string stripdir(const string &)
#define RFLUPART
Definition: clop.H:117
bool GetOp(const string &ops, const vector< string > &args)
void AddOp(const string &lo, const char &so)
void Usage(const string &pn)
subroutine rflupart(caseString, verbLevel)
Definition: rflupart.F90:48
#define FC_GLOBAL(name, NAME)
Definition: FC.h:5
vector< string > Vectize(const char **)
Definition: clop.C:182

Here is the call graph for this function: