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
Go to the documentation of this file.
1
/* *******************************************************************
2
* Illinois Open Source License *
3
* *
4
* University of Illinois/NCSA *
5
* Open Source License *
6
* *
7
* Copyright@2008, University of Illinois. All rights reserved. *
8
* *
9
* Developed by: *
10
* *
11
* Center for Simulation of Advanced Rockets *
12
* *
13
* University of Illinois *
14
* *
15
* www.csar.uiuc.edu *
16
* *
17
* Permission is hereby granted, free of charge, to any person *
18
* obtaining a copy of this software and associated documentation *
19
* files (the "Software"), to deal with the Software without *
20
* restriction, including without limitation the rights to use, *
21
* copy, modify, merge, publish, distribute, sublicense, and/or *
22
* sell copies of the Software, and to permit persons to whom the *
23
* Software is furnished to do so, subject to the following *
24
* conditions: *
25
* *
26
* *
27
* @ Redistributions of source code must retain the above copyright *
28
* notice, this list of conditions and the following disclaimers. *
29
* *
30
* @ Redistributions in binary form must reproduce the above *
31
* copyright notice, this list of conditions and the following *
32
* disclaimers in the documentation and/or other materials *
33
* provided with the distribution. *
34
* *
35
* @ Neither the names of the Center for Simulation of Advanced *
36
* Rockets, the University of Illinois, nor the names of its *
37
* contributors may be used to endorse or promote products derived *
38
* from this Software without specific prior written permission. *
39
* *
40
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47
* USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48
*********************************************************************
49
* Please acknowledge The University of Illinois Center for *
50
* Simulation of Advanced Rockets in works and publications *
51
* resulting from this software or its derivatives. *
52
*********************************************************************/
53
#include <iostream>
54
#include <vector>
55
#include <list>
56
#include <sstream>
57
58
using namespace
std;
59
60
#include "
clop.H
"
61
#include "
FC.h
"
62
63
extern
"C"
{
64
void
FC_GLOBAL
(
rflupart
,
RFLUPART
)(
const
char
*,
int
*,
long
int);
65
}
66
67
void
68
Usage
(
const
string
&pn)
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
}
79
80
int
81
main
(
int
argc,
char
*argv[])
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
}
150
stripdir
const string stripdir(const string &)
clop.H
RFLUPART
#define RFLUPART
Definition:
clop.H:117
GetOp
bool GetOp(const string &ops, const vector< string > &args)
AddOp
void AddOp(const string &lo, const char &so)
Usage
void Usage(const string &pn)
Definition:
standalone/main.C:37
rflupart
subroutine rflupart(caseString, verbLevel)
Definition:
rflupart.F90:48
FC.h
main
int main(int argc, char *argv[])
Definition:
blastest.C:94
FC_GLOBAL
#define FC_GLOBAL(name, NAME)
Definition:
FC.h:5
Vectize
vector< string > Vectize(const char **)
Definition:
clop.C:182
RocfluidMP
utilities
rocflu
part
main.C
Generated on Wed Nov 30 2016 16:56:08 for Rocstar by
1.8.5