Page MenuHomeHEPForge

ScannerSInterface.cpp
No OneTemporary

ScannerSInterface.cpp

#include "ScannerSInterface.h"
using namespace std;
string ReturnOption(int argc, char ** & argv, std::string option){
unsigned int pos=0;
string output;
while(pos!= argc && string(argv[pos])!=option)
++pos;
if((++pos)<argc)
output=string(argv[pos]);
return output;
}
void RedirectOstream(std::ostream & os,std::ofstream & ofsredir,std::streambuf * obuff,int argc, char ** & argv,std::string & filename, std::string option){
filename=ReturnOption(argc,argv,option.c_str());
if(filename.size()!=0){
ofsredir.open(filename.c_str());
obuff = ofsredir.rdbuf();
os.rdbuf(obuff);
}
else{
ofsredir.open("model.out");
obuff = ofsredir.rdbuf();
os.rdbuf(obuff);
}
}
void RedirectInfostream(std::ostream & os,std::ofstream & ofsredir,std::streambuf * obuff,int argc, char ** & argv,std::string & filename, std::string option){
filename=ReturnOption(argc,argv,option.c_str());
if(filename.size()!=0){
ofsredir.open(filename.c_str());
obuff = ofsredir.rdbuf();
os.rdbuf(obuff);
}
}
void OpenInputFile(ifstream & instream,int argc, char ** & argv,std::string & inputfile, std::string option){
inputfile=ReturnOption(argc,argv,option.c_str());
if(inputfile.size()!=0)
instream.open(inputfile.c_str());
else{
cerr << endl<<"ERROR: No input filename provided! Please rerun including the option :"<<endl<<endl<<" $ ./ScannerS -i input_filename (...) "<< endl<< endl;
exit(-1); //Exit in error
}
}
void CheckHelpNeeded(int argc, char ** & argv){
unsigned int pos=0;
while(pos!= argc && string(argv[pos])!=string("--help"))
++pos;
if((++pos)<=argc){
cout << endl<<"**** HELP *****************************************" << endl<< endl;
cout << "To compile and run the program do:"<< endl<< "\t $ make" <<endl<<"\t $ ./ScannerS -i input_file_name"<< endl<<endl<< "To clean the compilation do"<< endl<<"\t $ make clean"<< endl<< endl;
cout << "To run the program in verbose mode, uncomment the following line in the makefile:" << endl<<" #MODE=-DVERBOSE"<< endl<< endl<<"by removing the hash, i.e."<<endl<< " MODE=-DVERBOSE"<< endl << endl;
cout << "Other runtime options are :"<< endl<< endl;
cout << "-i input_file_name \t"<<endl<<" **************************************"<<endl<<" Specify the Mathematica produced input file name where to read the potential from."<< endl<< endl;
cout << "-o output_file_name [this is optional] \t "<<endl<<" **************************************"<<endl<<" Redirect cout to write the results of the scan to the the output file specified. Otherwise the file model.out is created."<< endl<< endl;
cout << "--nscan number_of_points_to_generate [this is optional] \t "<<endl<<" **************************************"<<endl<<" Specify the number of points to be generated. If not provided, 1 point will be generated."<< endl<< endl;
cout << "--seed seed_value [this is optional] \t "<<endl<<" **************************************"<<endl<<" Specify the seed for the pseudo-random number generator. If not provided, 0 will be used."<< endl<< endl;
cout << "--log log_file_name [this is optional] \t "<<endl<<" **************************************"<<endl<<" Redirect clog to write the information printed on screen for the user, to the the log file specified."<< endl<< endl;
cout << "--err err_file_name [this is optional] \t "<<endl<<" **************************************"<<endl<<" Redirect cerr to write the errors printed on screen for the user, to the the error file specified."<< endl<< endl;
cout<< "NOTE: The default output file is created with the name model.out"<< endl<< endl;
cout<< "Compile in verbose mode: If you want to recompile the code in verbose mode with very detailed info of each point that was attempted, follow these steps:"<< endl;
cout <<" \t $make clean"<< endl;
cout <<" \t $make MODE=-DVERBOSE"<< endl<< endl;
cout << "**** END OF HELP *****************************************"<< endl<< endl;
exit(0);
}
}

File Metadata

Mime Type
text/x-c
Expires
Sat, Dec 21, 6:04 PM (7 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4019548
Default Alt Text
ScannerSInterface.cpp (3 KB)

Event Timeline