76 int main(
int argc,
char **argv )
78 std::cout << __DATE__ <<
" Running program: " << argv[ 0 ] << std::endl;
80 std::cout <<
"Parsing command line parameters...";
83 std::cout <<
"[DONE]\n";
87 std::cout <<
"[DONE]\n";
89 std::cout <<
"Output is saved at " <<
outputfile <<
"!\n";
94 std::cout <<
"[DONE]\n";
96 std::cerr <<
"Error parsing command line parameters!\n";
97 std::cerr <<
"File: " << __FILE__ << std::endl;
98 std::cerr <<
"Line: " << __LINE__ << std::endl;
115 std::string dummyline;
119 if( !ofs.is_open( ) )
121 std::cerr <<
"\n Error: Cannot open output file " <<
outputfile << std::endl;
122 std::cerr <<
"File: " << __FILE__ << std::endl;
123 std::cerr <<
"Line: " << __LINE__ << std::endl;
126 ofs <<
"0.00E+000\n";
129 ifs.open( (
prjname+std::string(
".top") ).c_str( ) );
130 if( !ifs.is_open( ) )
132 std::cerr <<
"\n Error: Cannot open input file " <<
prjname+std::string(
".top") << std::endl;
133 std::cerr <<
"File: " << __FILE__ << std::endl;
134 std::cerr <<
"Line: " << __LINE__ << std::endl;
137 std::getline( ifs, dummyline );
138 std::getline( ifs, dummyline );
141 std::getline( ifs, dummyline );
144 ofs <<
i <<
" 0 0\n";
146 int blockidx,bc,npatches;
150 std::getline( ifs, dummyline );
152 std::getline( ifs, dummyline );
154 for(
int j=0;
j < npatches; ++
j )
157 std::getline( ifs, dummyline );
159 ofs << blockidx <<
" 0\n";
172 std::cout <<
"plagprep -- generates the initial particle solution dump at t=0\n";
173 std::cout <<
"OPTIONS:\n";
174 std::cout <<
"-bc {bc} sets the boundary condition used to identify injection surfaces. Default is 91.\n";
175 std::cout <<
"-p {projectname} sets the project name, essentially the filename without the suffix.\n";
176 std::cout <<
"-h prints this help menu.\n";
177 std::cout <<
"Usage: ./plagprep -p titan_60s_MP\n";
190 for(
int i=1;
i < argc; ++
i )
192 if( std::strcmp( argv[
i ],
"-bc") == 0 )
196 else if( std::strcmp( argv[ i ],
"-p") == 0 )
198 prjname = std::string( argv[ ++i ] );
201 else if( std::strcmp( argv[ i ],
"-h") == 0 )
int bndrycondition
The boundary condition corresponding to an injecting surface.
void searchTopFile()
Searches the prjname.top file for injecting boundary conditions.
std::string outputfile
Output file to write the file.
bool parseCmdParameters(int argc, char **argv)
Parses the user-supplied parameters for this utility.
void showUsage()
Prints usage and examples to STDOUT.
int main(int argc, char *argv[])