diff options
Diffstat (limited to 'src/Skeleton_blocker/example')
3 files changed, 25 insertions, 23 deletions
diff --git a/src/Skeleton_blocker/example/Skeleton_blocker_from_simplices.cpp b/src/Skeleton_blocker/example/Skeleton_blocker_from_simplices.cpp index 2738c01c..5935a56d 100644 --- a/src/Skeleton_blocker/example/Skeleton_blocker_from_simplices.cpp +++ b/src/Skeleton_blocker/example/Skeleton_blocker_from_simplices.cpp @@ -35,24 +35,23 @@ using namespace skbl; typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex; typedef Complex::Vertex_handle Vertex_handle; -typedef Complex::Simplex_handle Simplex_handle; -typedef Complex::Simplex_handle Simplex; +typedef Complex::Simplex Simplex; int main(int argc, char *argv[]) { - std::vector<Simplex_handle> simplices; + std::vector<Simplex> simplices; // add 4 triangles of a tetrahedron 0123 - simplices.push_back(Simplex_handle(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2))); - simplices.push_back(Simplex_handle(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3))); - simplices.push_back(Simplex_handle(Vertex_handle(3), Vertex_handle(0), Vertex_handle(2))); - simplices.push_back(Simplex_handle(Vertex_handle(3), Vertex_handle(0), Vertex_handle(1))); + simplices.push_back(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2))); + simplices.push_back(Simplex(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3))); + simplices.push_back(Simplex(Vertex_handle(3), Vertex_handle(0), Vertex_handle(2))); + simplices.push_back(Simplex(Vertex_handle(3), Vertex_handle(0), Vertex_handle(1))); // get complex from top faces Complex complex(make_complex_from_top_faces<Complex>(simplices.begin(), simplices.end())); std::cout << "Simplices:" << std::endl; - for (const Simplex & s : complex.simplex_range()) + for (const Simplex & s : complex.complex_simplex_range()) std::cout << s << " "; std::cout << std::endl; @@ -61,16 +60,16 @@ int main(int argc, char *argv[]) { // now build a complex from its full list of simplices simplices.clear(); - simplices.push_back(Simplex_handle(Vertex_handle(0))); - simplices.push_back(Simplex_handle(Vertex_handle(1))); - simplices.push_back(Simplex_handle(Vertex_handle(2))); - simplices.push_back(Simplex_handle(Vertex_handle(0), Vertex_handle(1))); - simplices.push_back(Simplex_handle(Vertex_handle(1), Vertex_handle(2))); - simplices.push_back(Simplex_handle(Vertex_handle(2), Vertex_handle(0))); + simplices.push_back(Simplex(Vertex_handle(0))); + simplices.push_back(Simplex(Vertex_handle(1))); + simplices.push_back(Simplex(Vertex_handle(2))); + simplices.push_back(Simplex(Vertex_handle(0), Vertex_handle(1))); + simplices.push_back(Simplex(Vertex_handle(1), Vertex_handle(2))); + simplices.push_back(Simplex(Vertex_handle(2), Vertex_handle(0))); complex = Complex(simplices.begin(), simplices.end()); std::cout << "Simplices:" << std::endl; - for (const Simplex & s : complex.simplex_range()) + for (const Simplex & s : complex.complex_simplex_range()) std::cout << s << " "; std::cout << std::endl; diff --git a/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp b/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp index 69557694..41b5ee00 100644 --- a/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp +++ b/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp @@ -37,7 +37,7 @@ using namespace skbl; typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex; typedef Complex::Vertex_handle Vertex_handle; -typedef Complex::Simplex_handle Simplex; +typedef Complex::Simplex Simplex; Complex build_complete_complex(int n) { // build a full complex with n vertices and 2^n-1 simplices @@ -46,8 +46,7 @@ Complex build_complete_complex(int n) { complex.add_vertex(); for (int i = 0; i < n; i++) for (int j = 0; j < i; j++) - // note that add_edge, add the edge and all its cofaces - complex.add_edge(Vertex_handle(i), Vertex_handle(j)); + complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(j)); return complex; } @@ -77,7 +76,7 @@ int main(int argc, char *argv[]) { // we use a reference to a simplex instead of a copy // value here because a simplex is a set of integers // and copying it cost time - for (const Simplex & s : complex.simplex_range()) { + for (const Simplex & s : complex.complex_simplex_range()) { ++num_simplices; if (s.dimension() % 2 == 0) euler += 1; diff --git a/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp b/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp index 002cbc49..698a8106 100644 --- a/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp +++ b/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp @@ -35,13 +35,16 @@ using namespace skbl; typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex; typedef Complex::Vertex_handle Vertex_handle; typedef Complex::Root_vertex_handle Root_vertex_handle; -typedef Complex::Simplex_handle Simplex; +typedef Complex::Simplex Simplex; int main(int argc, char *argv[]) { // build a full complex with 4 vertices and 2^4-1 simplices - // Initial vertices are (0,1,2,3,4) - Simplex tetrahedron(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3)); + + // Create a complex with four vertices (0,1,2,3) Complex complex; + + // Add a tetrahedron to this complex + Simplex tetrahedron(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3)); complex.add_simplex(tetrahedron); cout << "complex:" << complex.to_string() << endl; @@ -61,7 +64,8 @@ int main(int argc, char *argv[]) { // To access to the initial vertices eg (0,1,2,3,4), Root_vertex_handle must be used. // For instance, to test if the link contains the vertex that was labeled i: for (int i = 0; i < 5; ++i) - cout << "link.contains_vertex(Root_vertex_handle(" << i << ")):" << link.contains_vertex(Root_vertex_handle(i)) << endl; + cout << "link.contains_vertex(Root_vertex_handle(" << i << ")):" << + link.contains_vertex(Root_vertex_handle(i)) << endl; return EXIT_SUCCESS; } |