From 2d0c9ac7759dde1b0d2e41a147ac1a82bbc0081d Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 14 Apr 2015 16:33:51 +0000 Subject: Ready for testing! git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@565 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 4cce2055368e8d9ade18d522d16daeea32acb893 --- .../example/witness_complex_from_file.cpp | 3 +- .../example/witness_complex_from_off.cpp | 44 +++++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) (limited to 'src/Witness_complex/example') diff --git a/src/Witness_complex/example/witness_complex_from_file.cpp b/src/Witness_complex/example/witness_complex_from_file.cpp index c0e062fd..cf09899b 100644 --- a/src/Witness_complex/example/witness_complex_from_file.cpp +++ b/src/Witness_complex/example/witness_complex_from_file.cpp @@ -110,7 +110,8 @@ int main (int argc, char * const argv[]) // witnessComplex.witness_complex_from_points(point_vector); std::vector > WL; start = clock(); - witnessComplex.landmark_choice_by_furthest_points(point_vector, point_vector.size(), WL); + //witnessComplex.landmark_choice_by_furthest_points(point_vector, point_vector.size(), WL); + witnessComplex.landmark_choice_by_random_points(point_vector, point_vector.size(), WL); end = clock(); std::cout << "Landmark choice took " << (double)(end-start)/CLOCKS_PER_SEC << " s. \n"; diff --git a/src/Witness_complex/example/witness_complex_from_off.cpp b/src/Witness_complex/example/witness_complex_from_off.cpp index b1d7575a..04d4e601 100644 --- a/src/Witness_complex/example/witness_complex_from_off.cpp +++ b/src/Witness_complex/example/witness_complex_from_off.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include //#include @@ -117,7 +119,8 @@ int main (int argc, char * const argv[]) clock_t start, end; //Construct the Simplex Tree Witness_complex<> witnessComplex; - + + /* std::cout << "Let the carnage begin!\n"; start = clock(); Point_Vector point_vector; @@ -137,4 +140,43 @@ int main (int argc, char * const argv[]) witnessComplex.st_to_file(ofs); ofs.close(); } + */ + std::cout << "Let the carnage begin!\n"; + Point_Vector point_vector; + off_reader_cust(file_name, point_vector); + //std::cout << "Successfully read the points\n"; + witnessComplex.setNbL(nbL); + // witnessComplex.witness_complex_from_points(point_vector); + std::vector > WL; + start = clock(); + //witnessComplex.landmark_choice_by_furthest_points(point_vector, point_vector.size(), WL); + witnessComplex.landmark_choice_by_random_points(point_vector, point_vector.size(), WL); + end = clock(); + std::cout << "Landmark choice took " + << (double)(end-start)/CLOCKS_PER_SEC << " s. \n"; + // Write the WL matrix in a file + mkdir("output", S_IRWXU); + const size_t last_slash_idx = file_name.find_last_of("/"); + if (std::string::npos != last_slash_idx) + { + file_name.erase(0, last_slash_idx + 1); + } + std::string out_file = "output/"+file_name+"_"+argv[2]+".wl"; + //write_wl(out_file,WL); + start = clock(); + witnessComplex.witness_complex(WL); + // + end = clock(); + std::cout << "Howdy world! The process took " + << (double)(end-start)/CLOCKS_PER_SEC << " s. \n"; + + out_file = "output/"+file_name+"_"+argv[2]+".stree"; + std::ofstream ofs (out_file, std::ofstream::out); + witnessComplex.st_to_file(ofs); + ofs.close(); + + out_file = "output/"+file_name+"_"+argv[2]+".badlinks"; + std::ofstream ofs2(out_file, std::ofstream::out); + witnessComplex.write_bad_links(ofs2); + ofs2.close(); } -- cgit v1.2.3