summaryrefslogtreecommitdiff
path: root/src/Contraction/example/Rips_contraction.cpp
diff options
context:
space:
mode:
authorsalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2014-12-12 09:14:20 +0000
committersalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2014-12-12 09:14:20 +0000
commitd5f559170c6674cf5534a9818d4a3a8a1e598165 (patch)
tree2ec3933eb935f9f1f7657fefd7e35ad6f6a7ffc4 /src/Contraction/example/Rips_contraction.cpp
parent425b462d361286822ee0ed7b5fe00881ba312ea3 (diff)
modif off reader +skbl geometry
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@349 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Diffstat (limited to 'src/Contraction/example/Rips_contraction.cpp')
-rw-r--r--src/Contraction/example/Rips_contraction.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/src/Contraction/example/Rips_contraction.cpp b/src/Contraction/example/Rips_contraction.cpp
index acfb516d..59cdec97 100644
--- a/src/Contraction/example/Rips_contraction.cpp
+++ b/src/Contraction/example/Rips_contraction.cpp
@@ -48,25 +48,28 @@ void build_rips(ComplexType& complex, double offset){
complex.add_edge(*p,*q);
}
+int main (int argc, char *argv[])
+{
+ if (argc!=3){
+ std::cerr << "Usage "<<argv[0]<<" GUDHIPATH/src/data/sphere3D.off 0.1 to load the file GUDHIPATH/src/data/sphere3D.off and contract the Rips complex built with paremeter 0.2.\n";
+ return -1;
+ }
-
-
-void test_contraction_rips(string name_file, double offset){
boost::timer::auto_cpu_timer t;
Complex complex;
// load the points
- Skeleton_blocker_off_reader<Complex> off_reader(name_file,complex,true);
+ Skeleton_blocker_off_reader<Complex> off_reader(argv[1],complex,true);
if(!off_reader.is_valid()){
- std::cerr << "Unable to read file:"<<name_file<<std::endl;
- return;
+ std::cerr << "Unable to read file:"<<argv[1]<<std::endl;
+ return EXIT_FAILURE;
}
- std::cerr << "build the Rips complex"<<std::endl;
+ std::cout << "build the Rips complex"<<std::endl;
- build_rips(complex,offset);
+ build_rips(complex,atof(argv[2]));
- std::cerr << "Initial complex has "<<
+ std::cout << "Initial complex has "<<
complex.num_vertices()<<" vertices, and "<<
complex.num_edges()<<" edges."<<std::endl;
@@ -77,24 +80,12 @@ void test_contraction_rips(string name_file, double offset){
contraction::make_remove_popable_blockers_visitor<Profile>());
contractor.contract_edges();
- std::cerr << "Resulting complex has "<<
+ std::cout << "Resulting complex has "<<
complex.num_vertices()<<" vertices, "<<
complex.num_edges()<<"edges and "<<
complex.num_blockers()<<" blockers"<<std::endl;
-
-}
-
-
-int main (int argc, char *argv[])
-{
- if (argc!=3){
- std::cerr << "Usage "<<argv[0]<<" GUDHIPATH/src/data/sphere3D.off 0.1 to load the file GUDHIPATH/src/data/sphere3D.off and contract the Rips complex built with paremeter 0.2.\n";
- return -1;
- }
-
- std::string name_file(argv[1]);
- test_contraction_rips(name_file,atof(argv[2]));
+ return EXIT_SUCCESS;
}