Add a default argument for BGL tests and examples, used when no command line argument in given.

This commit is contained in:
Guillaume Damiand 2018-10-18 11:04:14 +02:00
parent cd14640d9a
commit a1474a74d2
12 changed files with 25 additions and 25 deletions

View File

@ -15,10 +15,10 @@ typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
typedef boost::graph_traits<LCC>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<LCC>::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<int> distance(lcc.vertex_attributes().size());

View File

@ -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<vertex_descriptor> V;

View File

@ -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<LCC, CGAL::face_index_t>::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

View File

@ -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;

View File

@ -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<Source<LCC>,halfedge_around_target_iterator> adjacent_vertex_iterator;

View File

@ -15,10 +15,10 @@ typedef boost::graph_traits<Polyhedron>::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.

View File

@ -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;

View File

@ -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 ;

View File

@ -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);

View File

@ -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);

View File

@ -13,11 +13,11 @@ typedef CGAL::Surface_mesh<Point> Mesh;
typedef boost::graph_traits<Mesh>::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<vertex_descriptor,vertex_descriptor> predecessor;
predecessor = P.add_property_map<vertex_descriptor,vertex_descriptor>("v:predecessor").first;

View File

@ -30,7 +30,7 @@ typedef CGAL::Halfedge_around_target_iterator<Polyhedron> halfedge_around_target
typedef CGAL::Halfedge_around_face_iterator<Polyhedron> halfedge_around_face_iterator;
typedef CGAL::Face_around_face_iterator<Polyhedron> face_around_face_iterator;
typedef CGAL::Vertex_around_target_iterator<Polyhedron> vertex_around_target_iterator;
int main(int, char* argv[])
int main(int argc, char* argv[])
{
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_face_circulator>)) CGAL_UNUSED;
@ -49,7 +49,7 @@ int main(int, char* argv[])
BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator<in_edge_iterator>)) CGAL_UNUSED;
BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator<out_edge_iterator>)) CGAL_UNUSED;
std::ifstream in(argv[1]);
std::ifstream in((argc>1)?argv[1]:"data/cube.off");
Polyhedron P;
in >> P;