From a1474a74d2c0939895a7b7fc04f1d89e17f48cae Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Thu, 18 Oct 2018 11:04:14 +0200 Subject: [PATCH] Add a default argument for BGL tests and examples, used when no command line argument in given. --- BGL/examples/BGL_LCC/distance_lcc.cpp | 6 +++--- BGL/examples/BGL_LCC/incident_vertices_lcc.cpp | 4 ++-- BGL/examples/BGL_LCC/normals_lcc.cpp | 4 ++-- BGL/examples/BGL_LCC/range_lcc.cpp | 4 ++-- BGL/examples/BGL_LCC/transform_iterator_lcc.cpp | 4 ++-- BGL/examples/BGL_polyhedron_3/distance.cpp | 4 ++-- BGL/examples/BGL_polyhedron_3/incident_vertices.cpp | 4 ++-- BGL/examples/BGL_polyhedron_3/normals.cpp | 4 ++-- BGL/examples/BGL_polyhedron_3/range.cpp | 4 ++-- BGL/examples/BGL_polyhedron_3/transform_iterator.cpp | 4 ++-- BGL/examples/BGL_surface_mesh/prim.cpp | 4 ++-- BGL/test/BGL/test_circulator.cpp | 4 ++-- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/BGL/examples/BGL_LCC/distance_lcc.cpp b/BGL/examples/BGL_LCC/distance_lcc.cpp index 452ffe9eb0c..2dec36620db 100644 --- a/BGL/examples/BGL_LCC/distance_lcc.cpp +++ b/BGL/examples/BGL_LCC/distance_lcc.cpp @@ -15,11 +15,11 @@ typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper typedef boost::graph_traits::vertex_descriptor vertex_descriptor; typedef boost::graph_traits::vertex_iterator vertex_iterator; -int main(int, char** argv) +int main(int argc, char** argv) { LCC lcc; - CGAL::read_off(argv[1], lcc); - + CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc); + // This is the vector where the distance gets written to std::vector distance(lcc.vertex_attributes().size()); diff --git a/BGL/examples/BGL_LCC/incident_vertices_lcc.cpp b/BGL/examples/BGL_LCC/incident_vertices_lcc.cpp index 5466b303bd0..2dcc9bb3699 100644 --- a/BGL/examples/BGL_LCC/incident_vertices_lcc.cpp +++ b/BGL/examples/BGL_LCC/incident_vertices_lcc.cpp @@ -46,10 +46,10 @@ OutputIterator adjacent_vertices_V2(const LCC& g, } -int main(int, char** argv) +int main(int argc, char** argv) { LCC lcc; - CGAL::read_off(argv[1], lcc); + CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc); GraphTraits::vertex_iterator vi = vertices(lcc).first; std::list V; diff --git a/BGL/examples/BGL_LCC/normals_lcc.cpp b/BGL/examples/BGL_LCC/normals_lcc.cpp index 0563adb891e..3f2f4b29687 100644 --- a/BGL/examples/BGL_LCC/normals_lcc.cpp +++ b/BGL/examples/BGL_LCC/normals_lcc.cpp @@ -63,13 +63,13 @@ void calculate_face_normals(const HalfedgeGraph& g, } } -int main(int, char** argv) +int main(int argc, char** argv) { typedef boost::property_map::const_type Face_index_map; LCC lcc; - CGAL::read_off(argv[1], lcc); + CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc); // Ad hoc property_map to store normals. Face_index_map is used to // map face_descriptors to a contiguous range of indices. See diff --git a/BGL/examples/BGL_LCC/range_lcc.cpp b/BGL/examples/BGL_LCC/range_lcc.cpp index 91e9a739877..f52254be8b6 100644 --- a/BGL/examples/BGL_LCC/range_lcc.cpp +++ b/BGL/examples/BGL_LCC/range_lcc.cpp @@ -55,10 +55,10 @@ void fct(const LCC& lcc) std::for_each(vb,ve, Fct()); } -int main(int, char** argv) +int main(int argc, char** argv) { LCC lcc; - CGAL::read_off(argv[1], lcc); + CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc); fct(lcc); return 0; diff --git a/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp b/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp index 40f1f884fee..c865ce209b5 100644 --- a/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp +++ b/BGL/examples/BGL_LCC/transform_iterator_lcc.cpp @@ -38,10 +38,10 @@ struct Source { } }; -int main(int, char** argv) +int main(int argc, char** argv) { LCC lcc; - CGAL::read_off(argv[1], lcc); + CGAL::read_off((argc>1)?argv[1]:"cube.off", lcc); GraphTraits::vertex_descriptor vd = *(vertices(lcc).first); typedef boost::transform_iterator,halfedge_around_target_iterator> adjacent_vertex_iterator; diff --git a/BGL/examples/BGL_polyhedron_3/distance.cpp b/BGL/examples/BGL_polyhedron_3/distance.cpp index 51da1ac49d7..3cfc8e1aa0c 100644 --- a/BGL/examples/BGL_polyhedron_3/distance.cpp +++ b/BGL/examples/BGL_polyhedron_3/distance.cpp @@ -15,10 +15,10 @@ typedef boost::graph_traits::vertex_iterator vertex_iterator; -int main(int, char** argv) { +int main(int argc, char** argv) { Polyhedron P; - std::ifstream in(argv[1]); + std::ifstream in((argc>1)?argv[1]:"cube.off"); in >> P ; // associate indices to the vertices using the "id()" field of the vertex. diff --git a/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp b/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp index 6f7b8d24e00..4e79d97ca4f 100644 --- a/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp +++ b/BGL/examples/BGL_polyhedron_3/incident_vertices.cpp @@ -44,9 +44,9 @@ adjacent_vertices_V2(const Polyhedron& g, } -int main(int, char** argv) +int main(int argc, char** argv) { - std::ifstream in(argv[1]); + std::ifstream in((argc>1)?argv[1]:"cube.off"); Polyhedron P; in >> P; GraphTraits::vertex_iterator vi = vertices(P).first; diff --git a/BGL/examples/BGL_polyhedron_3/normals.cpp b/BGL/examples/BGL_polyhedron_3/normals.cpp index eed947b01fd..efa95a34f72 100644 --- a/BGL/examples/BGL_polyhedron_3/normals.cpp +++ b/BGL/examples/BGL_polyhedron_3/normals.cpp @@ -63,14 +63,14 @@ void calculate_face_normals(const HalfedgeGraph& g, } } -int main(int, char** argv) +int main(int argc, char** argv) { typedef boost::property_map< Polyhedron, CGAL::face_index_t >::const_type Face_index_map; - std::ifstream in(argv[1]); + std::ifstream in((argc>1)?argv[1]:"cube.off"); Polyhedron P; in >> P ; diff --git a/BGL/examples/BGL_polyhedron_3/range.cpp b/BGL/examples/BGL_polyhedron_3/range.cpp index 35bac222042..4e4c11aa2a1 100644 --- a/BGL/examples/BGL_polyhedron_3/range.cpp +++ b/BGL/examples/BGL_polyhedron_3/range.cpp @@ -55,10 +55,10 @@ void fct(const Polyhedron& p) std::for_each(vb,ve, Fct()); } -int main(int, char** argv) +int main(int argc, char** argv) { Polyhedron P; - std::ifstream in(argv[1]); + std::ifstream in((argc>1)?argv[1]:"cube.off"); in >> P ; fct(P); diff --git a/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp b/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp index c03df6f0b7f..776805c7a09 100644 --- a/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp +++ b/BGL/examples/BGL_polyhedron_3/transform_iterator.cpp @@ -37,9 +37,9 @@ struct Source { } }; -int main(int, char** argv) +int main(int argc, char** argv) { - std::ifstream in(argv[1]); + std::ifstream in((argc>1)?argv[1]:"cube.off"); Polyhedron P; in >> P; GraphTraits::vertex_descriptor vd = *(vertices(P).first); diff --git a/BGL/examples/BGL_surface_mesh/prim.cpp b/BGL/examples/BGL_surface_mesh/prim.cpp index 9a3e2d200ef..08ad8806170 100644 --- a/BGL/examples/BGL_surface_mesh/prim.cpp +++ b/BGL/examples/BGL_surface_mesh/prim.cpp @@ -13,11 +13,11 @@ typedef CGAL::Surface_mesh Mesh; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; -int main(int, char* argv[]) +int main(int argc, char* argv[]) { Mesh P; //std::cin >> P; - std::ifstream in(argv[1]); + std::ifstream in((argc>1)?argv[1]:"data/prim.off"); in >> P; Mesh::Property_map predecessor; predecessor = P.add_property_map("v:predecessor").first; diff --git a/BGL/test/BGL/test_circulator.cpp b/BGL/test/BGL/test_circulator.cpp index 8cd8ac1e6ec..1237d2e4801 100644 --- a/BGL/test/BGL/test_circulator.cpp +++ b/BGL/test/BGL/test_circulator.cpp @@ -30,7 +30,7 @@ typedef CGAL::Halfedge_around_target_iterator halfedge_around_target typedef CGAL::Halfedge_around_face_iterator halfedge_around_face_iterator; typedef CGAL::Face_around_face_iterator face_around_face_iterator; typedef CGAL::Vertex_around_target_iterator vertex_around_target_iterator; -int main(int, char* argv[]) +int main(int argc, char* argv[]) { BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator)) CGAL_UNUSED; @@ -49,7 +49,7 @@ int main(int, char* argv[]) BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator)) CGAL_UNUSED; BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator)) CGAL_UNUSED; - std::ifstream in(argv[1]); + std::ifstream in((argc>1)?argv[1]:"data/cube.off"); Polyhedron P; in >> P;