summaryrefslogtreecommitdiff
path: root/src/Witness_complex/example
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-04-14 16:33:51 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-04-14 16:33:51 +0000
commit2d0c9ac7759dde1b0d2e41a147ac1a82bbc0081d (patch)
treec68e1a2abbdf3be301a85a3ffef75c4af4377f98 /src/Witness_complex/example
parent001cb626d2ce452e6c258eb326f60544be7c1b3c (diff)
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
Diffstat (limited to 'src/Witness_complex/example')
-rw-r--r--src/Witness_complex/example/witness_complex_from_file.cpp3
-rw-r--r--src/Witness_complex/example/witness_complex_from_off.cpp44
2 files changed, 45 insertions, 2 deletions
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<std::vector< int > > 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 <iostream>
#include <fstream>
#include <ctime>
+#include <sys/types.h>
+#include <sys/stat.h>
//#include <stdlib.h>
@@ -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<std::vector< int > > 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();
}