From 8296ba7efdeba0c5edb312d24ba4211425dae674 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Wed, 20 Jan 2021 08:51:36 +0100 Subject: [PATCH] Remove cmp file for theta_io example in Cone_spanners_2 package. --- .../examples/Cone_spanners_2/theta_io.cmd | 1 - .../examples/Cone_spanners_2/theta_io.cpp | 27 +++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) delete mode 100644 Cone_spanners_2/examples/Cone_spanners_2/theta_io.cmd diff --git a/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cmd b/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cmd deleted file mode 100644 index ddce4442855..00000000000 --- a/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cmd +++ /dev/null @@ -1 +0,0 @@ -4 data/n9.cin diff --git a/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cpp b/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cpp index f070784e005..4096cf1c71f 100644 --- a/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cpp +++ b/Cone_spanners_2/examples/Cone_spanners_2/theta_io.cpp @@ -26,26 +26,37 @@ typedef boost::adjacency_list 1 && + (!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help") || !strcmp(argv[1],"-?"))) + { std::cout << "Usage: " << argv[0] << " [ ]" << std::endl; return 1; } - unsigned int k = atoi(argv[1]); - if (k<2) { - std::cout << "The number of cones should be larger than 1!" << std::endl; - return 1; + if (argc > 1) + { + k = atoi(argv[1]); + if (k<2) { + std::cout << "The number of cones should be larger than 1!" << std::endl; + return 1; + } } + if (argc > 2) + { filename=std::string(argv[2]); } + // open the file containing the vertex list - std::ifstream inf(argv[2]); + std::ifstream inf(filename); if (!inf) { - std::cout << "Cannot open file " << argv[2] << "!" << std::endl; + std::cout << "Cannot open file " << filename << "!" << std::endl; return 1; } Direction_2 initial_direction; - if (argc == 3) + if (argc == 1 || argc == 3) initial_direction = Direction_2(1, 0); // default initial_direction else if (argc == 5) initial_direction = Direction_2(atof(argv[3]), atof(argv[4]));