use argc/argv to pass the argument

This commit is contained in:
Andreas Fabri 2014-06-13 09:51:31 +02:00
parent f531ee2fa9
commit 9170b0a866
8 changed files with 16 additions and 15 deletions

View File

@ -0,0 +1 @@
cube.off

View File

@ -18,12 +18,10 @@ typedef boost::graph_traits<Polyhedron>::vertex_iterator vertex_iterator;
int main() { int main(int argc, char** argv) {
Polyhedron P; Polyhedron P;
std::ifstream in(argv[1]);
std::ifstream in("cube.off");
in >> P ; in >> P ;
// associate indices to the vertices using the "id()" field of the vertex. // associate indices to the vertices using the "id()" field of the vertex.

View File

@ -0,0 +1 @@
cube.off

View File

@ -46,10 +46,10 @@ adjacent_vertices_V2(const Polyhedron& g,
} }
int main() int main(int argc, char** argv)
{ {
std::ifstream in(argv[1]);
Polyhedron P; Polyhedron P;
std::ifstream in("cube.off");
in >> P; in >> P;
GraphTraits::vertex_iterator vi = vertices(P).first; GraphTraits::vertex_iterator vi = vertices(P).first;
std::list<vertex_descriptor> V; std::list<vertex_descriptor> V;

View File

@ -0,0 +1 @@
cube.off

View File

@ -69,18 +69,16 @@ void calculate_face_normals(const HalfedgeGraph& g,
} }
} }
int main() int main(int argc, char** argv)
{ {
typedef boost::property_map< typedef boost::property_map<
Polyhedron, Polyhedron,
CGAL::face_index_t CGAL::face_index_t
>::const_type Face_index_map; >::const_type Face_index_map;
std::ifstream in(argv[1]);
Polyhedron P; Polyhedron P;
{
std::ifstream in("cube.off");
in >> P ; in >> P ;
}
// initialize facet indices // initialize facet indices
std::size_t i = 0; std::size_t i = 0;

View File

@ -0,0 +1 @@
cube.off

View File

@ -38,10 +38,11 @@ struct Source {
} }
}; };
int main() int main(int argc, char** argv)
{ {
std::ifstream in(argv[1]);
Polyhedron P; Polyhedron P;
std::cin >> P; in >> P;
GraphTraits::vertex_descriptor vd = *(vertices(P).first); GraphTraits::vertex_descriptor vd = *(vertices(P).first);
typedef boost::transform_iterator<Source<Polyhedron>,halfedge_around_target_iterator> adjacent_vertex_iterator; typedef boost::transform_iterator<Source<Polyhedron>,halfedge_around_target_iterator> adjacent_vertex_iterator;