1212// Use the namespaces of Chrono
1313using namespace chrono ;
1414
15- // usage: ./sphere_deca.exe [DATADIR] [--nogui]
16- //
17- // If no argument is given user can set HYDROCHRONO_DATA_DIR
18- // environment variable to give the data_directory.
19- //
2015int main (int argc, char * argv[]) {
2116 std::cout << " Chrono version: " << CHRONO_VERSION << " \n\n " ;
2217
23- if (hydroc::SetInitialEnvironment (argc, argv) != 0 ) {
24- return 1 ;
25- }
26-
27- // Check if --nogui option is set as 2nd argument
18+ // Parse CLI arguments and initialize environment
19+ bool profilingOn = true ;
20+ bool saveDataOn = true ;
2821 bool visualizationOn = true ;
29- if (argc > 2 && std::string (" --nogui" ).compare (argv[2 ]) == 0 ) {
30- visualizationOn = false ;
31- }
22+ std::string data_dir;
23+ if (!hydroc::GetCLIArguments (argc, argv, " Sphere decay demo" , saveDataOn, profilingOn, visualizationOn, data_dir))
24+ return 1 ;
25+ if (!hydroc::SetInitialEnvironment (data_dir)) return 1 ;
3226
3327 // Get model file names
3428 std::filesystem::path DATADIR (hydroc::getDataDir ());
@@ -54,9 +48,6 @@ int main(int argc, char* argv[]) {
5448
5549 hydroc::gui::UI& ui = *pui.get ();
5650
57- bool profilingOn = true ;
58- bool saveDataOn = true ;
59-
6051 // Output timeseries
6152 std::vector<double > time_vector;
6253 std::vector<double > heave_position;
@@ -99,7 +90,7 @@ int main(int argc, char* argv[]) {
9990 TestHydro hydro_forces (bodies, h5fname);
10091 hydro_forces.AddWaves (default_dont_add_waves);
10192
102- // for profilingvisualizationOn = false;
93+ // for profiling
10394 auto start = std::chrono::high_resolution_clock::now ();
10495
10596 // main simulation loop
0 commit comments