From 00b9eec7bc7cc33a43cdfa500792c3bb57c09fd3 Mon Sep 17 00:00:00 2001 From: Le-Jeng Shiue Date: Tue, 7 Mar 2006 05:35:35 +0000 Subject: [PATCH] use std::cin for input off file in the examples --- .../CatmullClark_subdivision.C | 12 +++++------- .../Customized_subdivision.C | 16 +++++++--------- .../Subdivision_method_3/DooSabin_subdivision.C | 12 +++++------- .../Subdivision_method_3/Loop_subdivision.C | 12 +++++------- 4 files changed, 22 insertions(+), 30 deletions(-) diff --git a/Subdivision_method_3/examples/Subdivision_method_3/CatmullClark_subdivision.C b/Subdivision_method_3/examples/Subdivision_method_3/CatmullClark_subdivision.C index e2b2ae5b1c3..f3edfeaeb68 100644 --- a/Subdivision_method_3/examples/Subdivision_method_3/CatmullClark_subdivision.C +++ b/Subdivision_method_3/examples/Subdivision_method_3/CatmullClark_subdivision.C @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -16,18 +15,17 @@ using namespace std; using namespace CGAL; int main(int argc, char** argv) { - if (argc != 3) { - cout << "Usage: CatmullClark_subdivision filename d" << endl; - cout << " filename: the input mash (.off)" << endl; + if (argc != 2) { + cout << "Usage: CatmullClark_subdivision d < filename" << endl; cout << " d: the depth of the subdivision (0 < d < 10)" << endl; + cout << " filename: the input mash (.off)" << endl; exit(1); } - ifstream in(argv[1]); - int d = argv[2][0] - '0'; + int d = argv[1][0] - '0'; Polyhedron P; - in >> P; // read the .off + cin >> P; // read the .off Subdivision_method_3::CatmullClark_subdivision(P,d); diff --git a/Subdivision_method_3/examples/Subdivision_method_3/Customized_subdivision.C b/Subdivision_method_3/examples/Subdivision_method_3/Customized_subdivision.C index b15561a6e09..93306207bbb 100644 --- a/Subdivision_method_3/examples/Subdivision_method_3/Customized_subdivision.C +++ b/Subdivision_method_3/examples/Subdivision_method_3/Customized_subdivision.C @@ -4,7 +4,6 @@ #include #include -#include #include #include @@ -18,7 +17,7 @@ using namespace CGAL; // ====================================================================== template -class WLoop_stencil_3 { +class WLoop_mask_3 { typedef Poly Polyhedron; typedef typename Polyhedron::Vertex_iterator Vertex_iterator; @@ -86,20 +85,19 @@ public: }; int main(int argc, char **argv) { - if (argc != 3) { - cout << "Usage: Customized_subdivision filename d" << endl; - cout << " filename: the input mash (.off)" << endl; + if (argc != 2) { + cout << "Usage: Customized_subdivision d < filename" << endl; cout << " d: the depth of the subdivision (0 < d < 10)" << endl; + cout << " filename: the input mash (.off)" << endl; exit(1); } - ifstream in(argv[1]); - int d = argv[2][0] - '0'; + int d = argv[1][0] - '0'; Polyhedron P; - in >> P; // read the .off + cin >> P; // read the .off - Subdivision_method_3::PTQ(P, WLoop_stencil_3(), d); + Subdivision_method_3::PTQ(P, WLoop_mask_3(), d); cout << P; // write the .off diff --git a/Subdivision_method_3/examples/Subdivision_method_3/DooSabin_subdivision.C b/Subdivision_method_3/examples/Subdivision_method_3/DooSabin_subdivision.C index 2cd5ae4824a..2fbc91d40e8 100644 --- a/Subdivision_method_3/examples/Subdivision_method_3/DooSabin_subdivision.C +++ b/Subdivision_method_3/examples/Subdivision_method_3/DooSabin_subdivision.C @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -16,18 +15,17 @@ using namespace std; using namespace CGAL; int main(int argc, char **argv) { - if (argc != 3) { - cout << "Usage: DooSabin_subdivision filename d" << endl; - cout << " filename: the input mash (.off)" << endl; + if (argc != 2) { + cout << "Usage: DooSabin_subdivision d < filename" << endl; cout << " d: the depth of the subdivision (0 < d < 10)" << endl; + cout << " filename: the input mash (.off)" << endl; exit(1); } - ifstream in(argv[1]); - int d = argv[2][0] - '0'; + int d = argv[1][0] - '0'; Polyhedron P; - in >> P; // read the .off + cin >> P; // read the .off Subdivision_method_3::DooSabin_subdivision(P,d); diff --git a/Subdivision_method_3/examples/Subdivision_method_3/Loop_subdivision.C b/Subdivision_method_3/examples/Subdivision_method_3/Loop_subdivision.C index f8df9091453..dd463fc437d 100644 --- a/Subdivision_method_3/examples/Subdivision_method_3/Loop_subdivision.C +++ b/Subdivision_method_3/examples/Subdivision_method_3/Loop_subdivision.C @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -16,18 +15,17 @@ using namespace std; using namespace CGAL; int main(int argc, char **argv) { - if (argc != 3) { - cout << "Usage: Loop_subdivision filename d" << endl; - cout << " filename: the input mash (.off)" << endl; + if (argc != 2) { + cout << "Usage: Loop_subdivision d < filename" << endl; cout << " d: the depth of the subdivision (0 < d < 10)" << endl; + cout << " filename: the input mash (.off)" << endl; exit(1); } - ifstream in(argv[1]); - int d = argv[2][0] - '0'; + int d = argv[1][0] - '0'; Polyhedron P; - in >> P; // read the .off + cin >> P; // read the .off Subdivision_method_3::Loop_subdivision(P,d);