From c6c91153dde643af2c5b9c78a1b1b9b65349c292 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 16 Nov 2015 10:09:38 +0000 Subject: cpplint fixes before merge git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/skb_simplex_insertion_merge@923 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: de9fc0770d273730de876a6ed54646847362bc7d --- .../example/Skeleton_blocker_link.cpp | 5 +- .../include/gudhi/Skeleton_blocker_complex.h | 58 +++++++++++----------- .../gudhi/Skeleton_blocker_simplifiable_complex.h | 29 ++++++----- 3 files changed, 46 insertions(+), 46 deletions(-) (limited to 'src/Skeleton_blocker') diff --git a/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp b/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp index 5e429728..698a8106 100644 --- a/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp +++ b/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp @@ -39,7 +39,7 @@ typedef Complex::Simplex Simplex; int main(int argc, char *argv[]) { // build a full complex with 4 vertices and 2^4-1 simplices - + // Create a complex with four vertices (0,1,2,3) Complex complex; @@ -64,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; } diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h index cf156a58..6612722e 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h @@ -23,18 +23,6 @@ #ifndef SKELETON_BLOCKER_COMPLEX_H_ #define SKELETON_BLOCKER_COMPLEX_H_ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include #include @@ -50,6 +38,18 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + namespace Gudhi { namespace skbl { @@ -550,13 +550,13 @@ class Skeleton_blocker_complex { * the edges 01, 12, 20 but not the triangle 012 (and hence this complex * will contains a blocker 012). */ - Edge_handle add_edge(Vertex_handle a, Vertex_handle b) { - //if the edge is already there we musnt go further - //as we may add blockers that should not be here - if(contains_edge(a,b)) - return *((*this)[std::make_pair(a,b)]); - auto res = add_edge_without_blockers(a,b); - add_blockers_after_simplex_insertion(Simplex(a,b)); + Edge_handle add_edge(Vertex_handle a, Vertex_handle b) { + // if the edge is already there we musnt go further + // as we may add blockers that should not be here + if (contains_edge(a, b)) + return *((*this)[std::make_pair(a, b)]); + auto res = add_edge_without_blockers(a, b); + add_blockers_after_simplex_insertion(Simplex(a, b)); return res; } @@ -564,9 +564,9 @@ class Skeleton_blocker_complex { * @brief Adds all edges of s in the complex. */ void add_edge(const Simplex& s) { - for(auto i = s.begin(); i != s.end(); ++i) - for(auto j = i; ++j != s.end(); /**/) - add_edge(*i,*j); + for (auto i = s.begin(); i != s.end(); ++i) + for (auto j = i; ++j != s.end(); /**/) + add_edge(*i, *j); } /** @@ -596,9 +596,9 @@ class Skeleton_blocker_complex { * @brief Adds all edges of s in the complex without adding blockers. */ void add_edge_without_blockers(Simplex s) { - for(auto i = s.begin(); i != s.end(); ++i){ - for(auto j = i; ++j != s.end(); /**/) - add_edge_without_blockers(*i,*j); + for (auto i = s.begin(); i != s.end(); ++i) { + for (auto j = i; ++j != s.end(); /**/) + add_edge_without_blockers(*i, *j); } } @@ -1014,10 +1014,10 @@ class Skeleton_blocker_complex { * @brief returns the number of simplices of a given dimension in the complex. */ size_t num_simplices(unsigned dimension) const { - //todo iterator on k-simplices + // TODO(DS): iterator on k-simplices size_t res = 0; - for(const auto& s: complex_simplex_range()) - if(s.dimension() == dimension) + for (const auto& s : complex_simplex_range()) + if (s.dimension() == dimension) ++res; return res; } @@ -1585,7 +1585,7 @@ class Skeleton_blocker_complex { template Complex make_complex_from_top_faces(SimplexHandleIterator simplices_begin, SimplexHandleIterator simplices_end, bool is_flag_complex = false) { - //todo use add_simplex instead! should be more efficient and more elegant :) + // TODO(DS): use add_simplex instead! should be more efficient and more elegant :) typedef typename Complex::Simplex Simplex; std::vector simplices; for (auto top_face = simplices_begin; top_face != simplices_end; ++top_face) { diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h index 1b7d58ff..94a125c1 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h @@ -218,7 +218,7 @@ void Skeleton_blocker_complex::add_simplex(const Simplex& sig this->add_vertex(); } assert(contains_vertices(sigma)); - if(!contains_edges(sigma)) + if (!contains_edges(sigma)) add_edge(sigma); remove_blocker_include_in_simplex(sigma); add_blockers_after_simplex_insertion(sigma); @@ -227,10 +227,10 @@ void Skeleton_blocker_complex::add_simplex(const Simplex& sig template -void Skeleton_blocker_complex::add_blockers_after_simplex_insertion(Simplex sigma){ - if(sigma.dimension() < 1) return; +void Skeleton_blocker_complex::add_blockers_after_simplex_insertion(Simplex sigma) { + if (sigma.dimension() < 1) return; - for(auto s : coboundary_range(sigma)) { + for (auto s : coboundary_range(sigma)) { this->add_blocker(s); } } @@ -254,10 +254,10 @@ void Skeleton_blocker_complex::remove_blocker_containing_simp */ template void Skeleton_blocker_complex::remove_blocker_include_in_simplex(const Simplex& sigma) { - //todo write efficiently by using only superior blockers - //eg for all s, check blockers whose vertices are all greater than s + // TODO(DS): write efficiently by using only superior blockers + // eg for all s, check blockers whose vertices are all greater than s std::set blockers_to_remove; - for(auto s : sigma) { + for (auto s : sigma) { for (auto blocker : this->blocker_range(s)) { if (sigma.contains(*blocker)) blockers_to_remove.insert(blocker); @@ -266,11 +266,11 @@ void Skeleton_blocker_complex::remove_blocker_include_in_simp for (auto blocker_to_update : blockers_to_remove) { auto s = *blocker_to_update; this->delete_blocker(blocker_to_update); - //now if there is a vertex v in the link of s - //and v is not included in sigma then v.s is a blocker - //(all faces of v.s are there since v belongs to the link of s) - for(const auto& b : coboundary_range(s)) - if(!sigma.contains(b)) + // now if there is a vertex v in the link of s + // and v is not included in sigma then v.s is a blocker + // (all faces of v.s are there since v belongs to the link of s) + for (const auto& b : coboundary_range(s)) + if (!sigma.contains(b)) this->add_blocker(b); } } @@ -384,9 +384,8 @@ Skeleton_blocker_complex::contract_edge(Vertex_handle a, Vert } template -void -Skeleton_blocker_complex::get_blockers_to_be_added_after_contraction(Vertex_handle a, Vertex_handle b, - std::set& blockers_to_add) { +void Skeleton_blocker_complex::get_blockers_to_be_added_after_contraction(Vertex_handle a, + Vertex_handle b, std::set& blockers_to_add) { blockers_to_add.clear(); typedef Skeleton_blocker_link_complex > LinkComplexType; -- cgit v1.2.3