Commit 6edb1f16 authored by VAN TOLL Wouter's avatar VAN TOLL Wouter
Browse files

Made the -o argument (output folder) optional, so that you can run...

Made the -o argument (output folder) optional, so that you can run high-performance simulations without storing the results.
parent 0fc1c17a
......@@ -39,11 +39,12 @@ void printBasicInfo()
void printUsageInfo(const std::string& programName)
{
std::cout
<< "Usage: " << programName << " -i -o [-t]" << std::endl
<< "Usage: " << programName << " -i [-o] [-t]" << std::endl
<< " -i (or -input) = An XML file describing the simulation scenario to run." << std::endl
<< " For help on creating scenario files, please see the UMANS documentation." << std::endl
<< " -o (or -output) = Name of a folder to which the simulation output will be written." << std::endl
<< " -o (or -output) = (optional) Name of a folder to which the simulation output will be written." << std::endl
<< " The program will write a CSV file for each agent's trajectory." << std::endl
<< " If you omit this, the program will run faster, but no results will be saved." << std::endl
<< " -t (or -nrThreads) = (optional, default=1) The number of parallel threads to use." << std::endl << std::endl;
}
......@@ -75,26 +76,35 @@ int main( int argc, char * argv[] )
nrThreads = atoi(paramValue.c_str());
}
// if any argument is incorrect, show an error
if (configFile == "" || outputFolder == "")
// input file is mandatory
if (configFile == "")
{
std::cerr << "Input error: Please specify all required arguments." << std::endl;
std::cerr << "Input error: Please specify an input scenario." << std::endl;
printUsageInfo(argv[0]);
return 0;
}
// number of threads must be at least 1
if (nrThreads < 1)
{
std::cerr << "Input error: Please specify a positive number of threads." << std::endl;
printUsageInfo(argv[0]);
return 0;
}
// output folder may be empty; if so, show a warning
if (outputFolder == "")
{
std::cout << "Input warning: No output folder specified." << std::endl
<< "The program will not write any simulation results to CSV files." << std::endl;
}
// run the simulation
CrowdSimulator* cs = CrowdSimulator::FromConfigFile(configFile, true);
if (cs != nullptr)
{
cs->SetCSVOutputDirectory(outputFolder);
if (outputFolder != "")
cs->SetCSVOutputDirectory(outputFolder);
cs->RunSimulationUntilEnd();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment