summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/example/Alpha_complex_from_off.cpp
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-10-20 10:04:05 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-10-20 10:04:05 +0000
commit8d656e33138ef8b3a7d86a7375c92646efc29511 (patch)
tree3711227c4c1b2a6e9f25dda1db8dafb8365063a0 /src/Alpha_complex/example/Alpha_complex_from_off.cpp
parent355dc2a0ae73f243fc0aa8d7c797509d8ba5e6b4 (diff)
parent30e538a98919004e36b3b382017884486919cb6e (diff)
Merge last trunk modification
Fix doc issue Still doc issue git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1739 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 0a99345f06e93a3525691699a6fe1505979e8e8e
Diffstat (limited to 'src/Alpha_complex/example/Alpha_complex_from_off.cpp')
-rw-r--r--src/Alpha_complex/example/Alpha_complex_from_off.cpp41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/Alpha_complex/example/Alpha_complex_from_off.cpp b/src/Alpha_complex/example/Alpha_complex_from_off.cpp
index 4f381d9f..d411e90a 100644
--- a/src/Alpha_complex/example/Alpha_complex_from_off.cpp
+++ b/src/Alpha_complex/example/Alpha_complex_from_off.cpp
@@ -1,4 +1,7 @@
#include <gudhi/Alpha_complex.h>
+// to construct a simplex_tree from alpha complex
+#include <gudhi/Simplex_tree.h>
+
#include <CGAL/Epick_d.h>
#include <iostream>
@@ -21,7 +24,7 @@ int main(int argc, char **argv) {
// Init of an alpha complex from an OFF file
// ----------------------------------------------------------------------------
using Kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >;
- Gudhi::alpha_complex::Alpha_complex<Kernel> alpha_complex_from_file(off_file_name, alpha_square_max_value);
+ Gudhi::alpha_complex::Alpha_complex<Kernel> alpha_complex_from_file(off_file_name);
std::streambuf* streambufffer;
std::ofstream ouput_file_stream;
@@ -33,23 +36,27 @@ int main(int argc, char **argv) {
streambufffer = std::cout.rdbuf();
}
- std::ostream output_stream(streambufffer);
-
- // ----------------------------------------------------------------------------
- // Display information about the alpha complex
- // ----------------------------------------------------------------------------
- output_stream << "Alpha complex is of dimension " << alpha_complex_from_file.dimension() <<
- " - " << alpha_complex_from_file.num_simplices() << " simplices - " <<
- alpha_complex_from_file.num_vertices() << " vertices." << std::endl;
-
- output_stream << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl;
- for (auto f_simplex : alpha_complex_from_file.filtration_simplex_range()) {
- output_stream << " ( ";
- for (auto vertex : alpha_complex_from_file.simplex_vertex_range(f_simplex)) {
- output_stream << vertex << " ";
+ Gudhi::Simplex_tree<> simplex;
+ if (alpha_complex_from_file.create_complex(simplex, alpha_square_max_value)) {
+ std::ostream output_stream(streambufffer);
+
+ // ----------------------------------------------------------------------------
+ // Display information about the alpha complex
+ // ----------------------------------------------------------------------------
+ output_stream << "Alpha complex is of dimension " << simplex.dimension() <<
+ " - " << simplex.num_simplices() << " simplices - " <<
+ simplex.num_vertices() << " vertices." << std::endl;
+
+ output_stream << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" <<
+ std::endl;
+ for (auto f_simplex : simplex.filtration_simplex_range()) {
+ output_stream << " ( ";
+ for (auto vertex : simplex.simplex_vertex_range(f_simplex)) {
+ output_stream << vertex << " ";
+ }
+ output_stream << ") -> " << "[" << simplex.filtration(f_simplex) << "] ";
+ output_stream << std::endl;
}
- output_stream << ") -> " << "[" << alpha_complex_from_file.filtration(f_simplex) << "] ";
- output_stream << std::endl;
}
ouput_file_stream.close();
return 0;