From 7efc964a35f06931803745f115ef675440f7e94b Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 30 Jun 2015 09:36:11 +0000 Subject: clang requires include fstream (Persistent_cohomology.h) clang build fails if include guard macro are not correctly defined + goole style fix (Skeleton_blockers_simplices_iterators.h) git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/compil_fix@665 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 4bbc74ac4726af768816c322bf77e104a1dcf1e6 --- .../Skeleton_blockers_simplices_iterators.h | 585 ++++++++++----------- 1 file changed, 275 insertions(+), 310 deletions(-) (limited to 'src/Skeleton_blocker') diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h index 666ce430..f9d4d072 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h @@ -1,46 +1,42 @@ - /* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): David Salinas - * - * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef GUDHI_KELETON_BLOCKERS_SIMPLICES_ITERATORS_H_ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): David Salinas + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef GUDHI_SKELETON_BLOCKERS_SIMPLICES_ITERATORS_H_ #define GUDHI_SKELETON_BLOCKERS_SIMPLICES_ITERATORS_H_ +#include "boost/iterator/iterator_facade.hpp" + #include #include #include -#include "gudhi/Utils.h" -#include "boost/iterator/iterator_facade.hpp" - #include "gudhi/Skeleton_blocker_link_complex.h" #include "gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h" - #include "gudhi/Skeleton_blocker/internal/Trie.h" - +#include "gudhi/Utils.h" namespace Gudhi { - namespace skbl { - /** * Link may be Skeleton_blocker_link_complex to iterate over all * simplices around a vertex OR @@ -49,299 +45,268 @@ namespace skbl { * The iteration is done by computing a trie with the link and doing a breadth-first traversal * of the trie. */ -template +template class Simplex_around_vertex_iterator : - public boost::iterator_facade < Simplex_around_vertex_iterator +public boost::iterator_facade < Simplex_around_vertex_iterator , typename SkeletonBlockerComplex::Simplex_handle , boost::forward_traversal_tag , typename SkeletonBlockerComplex::Simplex_handle -> -{ - friend class boost::iterator_core_access; - typedef SkeletonBlockerComplex Complex; - typedef typename Complex::Vertex_handle Vertex_handle; - typedef typename Complex::Edge_handle Edge_handle; - typedef typename Complex::Simplex_handle Simplex_handle; - - - typedef typename Link::Vertex_handle Link_vertex_handle; - // Link_vertex_handle == Complex_Vertex_handle but this renaming helps avoiding confusion - - typedef typename Gudhi::skbl::Trie Trie; - - -private: - const Complex* complex; - Vertex_handle v; - std::shared_ptr link_v; - std::shared_ptr trie; - std::list nodes_to_be_seen; // todo deque - -public: - Simplex_around_vertex_iterator():complex(0){ - } - - Simplex_around_vertex_iterator(const Complex* complex_,Vertex_handle v_): - complex(complex_), - v(v_), - link_v(new Link(*complex_,v_)), - trie(new Trie(v_)){ - compute_trie_and_nodes_to_be_seen(); - } - - // todo avoid useless copy - // todo currently just work if copy begin iterator - Simplex_around_vertex_iterator(const Simplex_around_vertex_iterator& other): - complex(other.complex), - v(other.v), - link_v(other.link_v), - trie(other.trie), - nodes_to_be_seen(other.nodes_to_be_seen){ - if(!other.is_end()){ - } - } - - /** - * returns an iterator to the end - */ - Simplex_around_vertex_iterator(const Complex* complex_,Vertex_handle v_,bool end): - complex(complex_), - v(v_){ - set_end(); - } - -private: - - - void compute_trie_and_nodes_to_be_seen(){ - // once we go through every simplices passing through v0 - // we remove v0. That way, it prevents from passing a lot of times - // though edges leaving v0. - // another solution would have been to provides an adjacency iterator - // to superior vertices that avoids lower ones. - while(!link_v->empty()){ - auto v0 = *(link_v->vertex_range().begin()); - trie->add_child(build_trie(v0,trie.get())); - link_v->remove_vertex(v0); - } - nodes_to_be_seen.push_back(trie.get()); - } - - Trie* build_trie(Link_vertex_handle link_vh,Trie* parent){ - Trie* res = new Trie(parent_vertex(link_vh),parent); - for(Link_vertex_handle nv : link_v->vertex_range(link_vh)) { - if(link_vh < nv){ - Simplex_handle simplex_node_plus_nv(res->simplex()); - simplex_node_plus_nv.add_vertex(parent_vertex(nv)); - if(complex->contains(simplex_node_plus_nv)){ - res->add_child(build_trie(nv,res)); - } - } - } - return res; - } - - bool is_node_in_complex(Trie* trie){ - return true; - } - - Vertex_handle parent_vertex(Link_vertex_handle link_vh) const{ - return complex->convert_handle_from_another_complex(*link_v,link_vh); - } - - - -public: - - friend std::ostream& operator<<(std::ostream& stream, const Simplex_around_vertex_iterator& savi){ - stream<< savi.trie<< std::endl; ; - stream << "("<childs){ - nodes_to_be_seen.push_back(childs.get()); - } - - } - - Simplex_handle dereference() const{ - assert(!nodes_to_be_seen.empty()); - Trie* first_node = nodes_to_be_seen.front(); - return first_node->simplex(); - } - -//private: - Simplex_handle get_trie_address() const{ - assert(!nodes_to_be_seen.empty()); - return nodes_to_be_seen.front(); - } - -private: - void set_end(){ - nodes_to_be_seen.clear(); - } - - bool is_end() const{ - return nodes_to_be_seen.empty(); - } +> { + friend class boost::iterator_core_access; + typedef SkeletonBlockerComplex Complex; + typedef typename Complex::Vertex_handle Vertex_handle; + typedef typename Complex::Edge_handle Edge_handle; + typedef typename Complex::Simplex_handle Simplex_handle; + + // Link_vertex_handle == Complex_Vertex_handle but this renaming helps avoiding confusion + typedef typename Link::Vertex_handle Link_vertex_handle; + + typedef typename Gudhi::skbl::Trie Trie; + + private: + const Complex* complex; + Vertex_handle v; + std::shared_ptr link_v; + std::shared_ptr trie; + std::list nodes_to_be_seen; // todo deque + + public: + Simplex_around_vertex_iterator() : complex(0) {} + + Simplex_around_vertex_iterator(const Complex* complex_, Vertex_handle v_) : + complex(complex_), + v(v_), + link_v(new Link(*complex_, v_)), + trie(new Trie(v_)) { + compute_trie_and_nodes_to_be_seen(); + } + + // todo avoid useless copy + // todo currently just work if copy begin iterator + Simplex_around_vertex_iterator(const Simplex_around_vertex_iterator& other) : + complex(other.complex), + v(other.v), + link_v(other.link_v), + trie(other.trie), + nodes_to_be_seen(other.nodes_to_be_seen) { + if (!other.is_end()) {} + } + + /** + * returns an iterator to the end + */ + Simplex_around_vertex_iterator(const Complex* complex_, Vertex_handle v_, bool end) : + complex(complex_), + v(v_) { + set_end(); + } + + private: + void compute_trie_and_nodes_to_be_seen() { + // once we go through every simplices passing through v0 + // we remove v0. That way, it prevents from passing a lot of times + // though edges leaving v0. + // another solution would have been to provides an adjacency iterator + // to superior vertices that avoids lower ones. + while (!link_v->empty()) { + auto v0 = *(link_v->vertex_range().begin()); + trie->add_child(build_trie(v0, trie.get())); + link_v->remove_vertex(v0); + } + nodes_to_be_seen.push_back(trie.get()); + } + + Trie* build_trie(Link_vertex_handle link_vh, Trie* parent) { + Trie* res = new Trie(parent_vertex(link_vh), parent); + for (Link_vertex_handle nv : link_v->vertex_range(link_vh)) { + if (link_vh < nv) { + Simplex_handle simplex_node_plus_nv(res->simplex()); + simplex_node_plus_nv.add_vertex(parent_vertex(nv)); + if (complex->contains(simplex_node_plus_nv)) { + res->add_child(build_trie(nv, res)); + } + } + } + return res; + } + + bool is_node_in_complex(Trie* trie) { + return true; + } + + Vertex_handle parent_vertex(Link_vertex_handle link_vh) const { + return complex->convert_handle_from_another_complex(*link_v, link_vh); + } + + public: + friend std::ostream& operator<<(std::ostream& stream, const Simplex_around_vertex_iterator& savi) { + stream << savi.trie << std::endl; + stream << "(" << savi.nodes_to_be_seen.size() << ") nodes to see\n"; + return stream; + } + + bool equal(const Simplex_around_vertex_iterator& other) const { + bool same_complex = (complex == other.complex); + if (!same_complex) + return false; + + if (!(v == other.v)) + return false; + + bool both_empty = nodes_to_be_seen.empty() && other.nodes_to_be_seen.empty(); + if (both_empty) + return true; + + bool both_non_empty = !nodes_to_be_seen.empty() && !other.nodes_to_be_seen.empty(); + + if (!both_non_empty) return false; //one is empty the other is not + + bool same_node = (**(nodes_to_be_seen.begin()) == **(other.nodes_to_be_seen.begin())); + return same_node; + } + + void increment() { + assert(!is_end()); + Trie* first_node = nodes_to_be_seen.front(); + + nodes_to_be_seen.pop_front(); + + for (auto childs : first_node->childs) { + nodes_to_be_seen.push_back(childs.get()); + } + + } + + Simplex_handle dereference() const { + assert(!nodes_to_be_seen.empty()); + Trie* first_node = nodes_to_be_seen.front(); + return first_node->simplex(); + } + + Simplex_handle get_trie_address() const { + assert(!nodes_to_be_seen.empty()); + return nodes_to_be_seen.front(); + } + + private: + void set_end() { + nodes_to_be_seen.clear(); + } + + bool is_end() const { + return nodes_to_be_seen.empty(); + } }; - - template class Simplex_iterator : - public boost::iterator_facade < Simplex_iterator +public boost::iterator_facade < Simplex_iterator , typename SkeletonBlockerComplex::Simplex_handle , boost::forward_traversal_tag , typename SkeletonBlockerComplex::Simplex_handle -> -{ - typedef Skeleton_blocker_link_superior Link; - - friend class boost::iterator_core_access; - - template friend class Skeleton_blocker_complex; - - - typedef SkeletonBlockerComplex Complex; - typedef typename Complex::Vertex_handle Vertex_handle; - typedef typename Complex::Edge_handle Edge_handle; - typedef typename Complex::Simplex_handle Simplex_handle; - - typedef typename Complex::Complex_vertex_iterator Complex_vertex_iterator; - - - typedef typename Link::Vertex_handle Link_vertex_handle; - -private: - - const Complex* complex_; - Complex_vertex_iterator current_vertex_; - - typedef Simplex_around_vertex_iterator SAVI; - SAVI current_simplex_around_current_vertex_; - SAVI simplices_around_current_vertex_end_; - - -public: - Simplex_iterator():complex_(0){} - - // should not be called if the complex is empty - Simplex_iterator(const Complex* complex): - complex_(complex), - current_vertex_(complex->vertex_range().begin()), - current_simplex_around_current_vertex_(complex,*current_vertex_), - simplices_around_current_vertex_end_(complex,*current_vertex_,true) - { - assert(!complex->empty()); - } - -private: - // todo return to private - Simplex_iterator(const Complex* complex,bool end): - complex_(complex) - { - set_end(); - } - -public: - - Simplex_iterator(const Simplex_iterator& other) - : - complex_(other.complex_), - current_vertex_(other.current_vertex_), - current_simplex_around_current_vertex_(other.current_simplex_around_current_vertex_), - simplices_around_current_vertex_end_(other.simplices_around_current_vertex_end_) - { - } - - friend Simplex_iterator make_begin_iterator(const Complex* complex){ - if(complex->empty()) - return make_end_simplex_iterator(complex); - else - return Simplex_iterator(complex); - } - - friend Simplex_iterator make_end_simplex_iterator(const Complex* complex){ - return Simplex_iterator(complex,true); - } - - bool equal(const Simplex_iterator& other) const{ - if(complex_!=other.complex_) return false; - if(current_vertex_!=other.current_vertex_) return false; - if(is_end() && other.is_end()) return true; - if(current_simplex_around_current_vertex_ != other.current_simplex_around_current_vertex_) - return false; - return true; - } - - void increment(){ - if(current_simplex_around_current_vertex_!= simplices_around_current_vertex_end_){ - current_simplex_around_current_vertex_.increment(); - if( current_simplex_around_current_vertex_== simplices_around_current_vertex_end_) - goto_next_vertex(); - } - else{ - goto_next_vertex(); - } - } - - void goto_next_vertex(){ - current_vertex_.increment(); - if(!is_end()){ - current_simplex_around_current_vertex_= SAVI(complex_,*current_vertex_); - simplices_around_current_vertex_end_ = SAVI(complex_,*current_vertex_,true); - } - } - - Simplex_handle dereference() const{ - return current_simplex_around_current_vertex_.dereference(); - } - -private: - void set_end(){ - current_vertex_ = complex_->vertex_range().end(); - } - - bool is_end() const{ - return (current_vertex_ == complex_->vertex_range().end()); - } +> { + typedef Skeleton_blocker_link_superior Link; + + friend class boost::iterator_core_access; + + template friend class Skeleton_blocker_complex; + + typedef SkeletonBlockerComplex Complex; + typedef typename Complex::Vertex_handle Vertex_handle; + typedef typename Complex::Edge_handle Edge_handle; + typedef typename Complex::Simplex_handle Simplex_handle; + typedef typename Complex::Complex_vertex_iterator Complex_vertex_iterator; + typedef typename Link::Vertex_handle Link_vertex_handle; + + private: + const Complex* complex_; + Complex_vertex_iterator current_vertex_; + + typedef Simplex_around_vertex_iterator SAVI; + SAVI current_simplex_around_current_vertex_; + SAVI simplices_around_current_vertex_end_; + + public: + Simplex_iterator() : complex_(0) { } + + Simplex_iterator(const Complex* complex) : + complex_(complex), + current_vertex_(complex->vertex_range().begin()), + current_simplex_around_current_vertex_(complex, *current_vertex_), + simplices_around_current_vertex_end_(complex, *current_vertex_, true) { + // should not be called if the complex is empty + assert(!complex->empty()); + } + + private: + // todo return to private + Simplex_iterator(const Complex* complex, bool end) : + complex_(complex) { + set_end(); + } + + public: + Simplex_iterator(const Simplex_iterator& other) + : + complex_(other.complex_), + current_vertex_(other.current_vertex_), + current_simplex_around_current_vertex_(other.current_simplex_around_current_vertex_), + simplices_around_current_vertex_end_(other.simplices_around_current_vertex_end_) { } + + friend Simplex_iterator make_begin_iterator(const Complex* complex) { + if (complex->empty()) + return make_end_simplex_iterator(complex); + else + return Simplex_iterator(complex); + } + + friend Simplex_iterator make_end_simplex_iterator(const Complex* complex) { + return Simplex_iterator(complex, true); + } + + bool equal(const Simplex_iterator& other) const { + if (complex_ != other.complex_) return false; + if (current_vertex_ != other.current_vertex_) return false; + if (is_end() && other.is_end()) return true; + if (current_simplex_around_current_vertex_ != other.current_simplex_around_current_vertex_) + return false; + return true; + } + + void increment() { + if (current_simplex_around_current_vertex_ != simplices_around_current_vertex_end_) { + current_simplex_around_current_vertex_.increment(); + if (current_simplex_around_current_vertex_ == simplices_around_current_vertex_end_) + goto_next_vertex(); + } else { + goto_next_vertex(); + } + } + + void goto_next_vertex() { + current_vertex_.increment(); + if (!is_end()) { + current_simplex_around_current_vertex_ = SAVI(complex_, *current_vertex_); + simplices_around_current_vertex_end_ = SAVI(complex_, *current_vertex_, true); + } + } + + Simplex_handle dereference() const { + return current_simplex_around_current_vertex_.dereference(); + } + + private: + void set_end() { + current_vertex_ = complex_->vertex_range().end(); + } + + bool is_end() const { + return (current_vertex_ == complex_->vertex_range().end()); + } }; +} // namespace skbl -} - -} // namespace GUDHI - - - - +} // namespace Gudhi -#endif /* SKELETON_BLOCKERS_SIMPLICES_ITERATORS_H_ */ +#endif // GUDHI_SKELETON_BLOCKERS_SIMPLICES_ITERATORS_H_ -- cgit v1.2.3 From ed7051a54f1a1320ddbf99893662f146ef791934 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 30 Jun 2015 11:48:48 +0000 Subject: for_each fix - clang issue but not used. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/compil_fix@666 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6eb72f54de768bbc00410ef88b77a4009e9b9882 --- .../include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Skeleton_blocker') diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h index 10d64e98..0a2fcb9a 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h @@ -69,7 +69,9 @@ class Skeleton_blocker_simplex { } Skeleton_blocker_simplex(std::initializer_list& list) { - for_each(list.begin(), list.end(), add_vertex); + std::for_each(list.begin(), list.end(), [&] (T const& elt) { + add_vertex(elt); + }); } template -- cgit v1.2.3 From 66d91feb5c6491b24e0765af777e35162e4cdc31 Mon Sep 17 00:00:00 2001 From: salinasd Date: Sat, 4 Jul 2015 15:41:57 +0000 Subject: Fix skbl compiling issue on clang + one issue of returning a local reference in Alpha_shapes git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/compil_fix@677 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b14047d0df46ea255bb801191c6672aa06eab3c7 --- src/Alpha_shapes/include/gudhi/Alpha_shapes.h | 2 +- .../example/Garland_heckbert/Error_quadric.h | 2 +- src/GudhUI/CMakeLists.txt | 3 +- .../Skeleton_blocker/Skeleton_blocker_off_io.h | 2 +- .../gudhi/Skeleton_blocker_geometric_complex.h | 34 ++++++++++++++-------- 5 files changed, 27 insertions(+), 16 deletions(-) (limited to 'src/Skeleton_blocker') diff --git a/src/Alpha_shapes/include/gudhi/Alpha_shapes.h b/src/Alpha_shapes/include/gudhi/Alpha_shapes.h index b8efdb4d..ae2ee80d 100644 --- a/src/Alpha_shapes/include/gudhi/Alpha_shapes.h +++ b/src/Alpha_shapes/include/gudhi/Alpha_shapes.h @@ -171,7 +171,7 @@ class Alpha_shapes { /** \brief Returns the number of simplices in the complex. * * Does not count the empty simplex. */ - const unsigned int& num_simplices() const { + unsigned num_simplices() const { return _st.num_simplices(); } diff --git a/src/Contraction/example/Garland_heckbert/Error_quadric.h b/src/Contraction/example/Garland_heckbert/Error_quadric.h index 725a3a56..72134c9d 100644 --- a/src/Contraction/example/Garland_heckbert/Error_quadric.h +++ b/src/Contraction/example/Garland_heckbert/Error_quadric.h @@ -122,7 +122,7 @@ public : * Return the point such that it minimizes the gradient of the quadric. * Det must be passed with the determinant value of the gradient (should be non zero). */ - inline Point solve_linear_gradient(double det = grad_determinant()) const{ + inline Point solve_linear_gradient(double det) const{ return Point({ (-coeff[1]*coeff[5]*coeff[8]+coeff[1]*coeff[7]*coeff[6]+coeff[2]*coeff[8]*coeff[4]-coeff[2]*coeff[5]*coeff[6]-coeff[3]*coeff[4]*coeff[7]+coeff[3]*coeff[5]*coeff[5])/ det, (coeff[0]*coeff[5]*coeff[8]-coeff[0]*coeff[7]*coeff[6]-coeff[5]*coeff[2]*coeff[3]-coeff[1]*coeff[2]*coeff[8]+coeff[6]*coeff[2]*coeff[2]+coeff[1]*coeff[3]*coeff[7])/det, diff --git a/src/GudhUI/CMakeLists.txt b/src/GudhUI/CMakeLists.txt index ddbae969..9348868a 100644 --- a/src/GudhUI/CMakeLists.txt +++ b/src/GudhUI/CMakeLists.txt @@ -5,6 +5,7 @@ find_package(CGAL COMPONENTS Qt4) find_package(Qt4) find_package(QGLViewer) find_package(OpenGL) + message("CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}") message("CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}") message("CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}") @@ -66,5 +67,5 @@ if ( CGAL_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) target_link_libraries( GudhUI ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ) else() - message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt4, and will not be compiled.") + message(STATUS "NOTICE: GudhUI requires CGAL, the QGLViewer, OpenGL and Qt4, and will not be compiled.") endif() diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h index aaaab8b0..6ad1fdd3 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h @@ -107,7 +107,7 @@ class Skeleton_blocker_off_visitor_reader { } void done() { - complex_ = make_complex_from_top_faces(maximal_faces_.begin(), maximal_faces_.end(), + complex_ = make_complex_from_top_faces(maximal_faces_.begin(), maximal_faces_.end(), points_.begin(), points_.end() ); } }; diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h index 437482cb..8cea123a 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h @@ -79,22 +79,13 @@ public Skeleton_blocker_complex { (*this)[Vertex_handle(current++)].point() = Point(point->begin(), point->end()); } - template - friend Skeleton_blocker_geometric_complex make_complex_from_top_faces( + template + SkeletonBlockerGeometricComplex make_complex_from_top_faces( SimpleHandleOutputIterator simplex_begin, SimpleHandleOutputIterator simplex_end, PointIterator points_begin, PointIterator points_end, - bool is_flag_complex = false) { - Skeleton_blocker_geometric_complex complex; - unsigned current = 0; - complex = - make_complex_from_top_faces(simplex_begin, simplex_end, is_flag_complex); - for (auto point = points_begin; point != points_end; ++point) - // complex.point(Vertex_handle(current++)) = Point(point->begin(),point->end()); - complex.point(Vertex_handle(current++)) = Point(*point); - return complex; - } + bool is_flag_complex); /** * @brief Constructor with a list of simplices. @@ -215,6 +206,25 @@ public Skeleton_blocker_complex { } }; + +template +SkeletonBlockerGeometricComplex make_complex_from_top_faces( + SimpleHandleOutputIterator simplex_begin, + SimpleHandleOutputIterator simplex_end, + PointIterator points_begin, + PointIterator points_end, + bool is_flag_complex = false) { + typedef SkeletonBlockerGeometricComplex SBGC; + SkeletonBlockerGeometricComplex complex; + unsigned current = 0; + complex = + make_complex_from_top_faces(simplex_begin, simplex_end, is_flag_complex); + for (auto point = points_begin; point != points_end; ++point) + // complex.point(Vertex_handle(current++)) = Point(point->begin(),point->end()); + complex.point(typename SBGC::Vertex_handle(current++)) = typename SBGC::Point(*point); + return complex; +} + } // namespace skbl } // namespace Gudhi -- cgit v1.2.3 From d37567802b2ca616ce3029e29972d450863a4946 Mon Sep 17 00:00:00 2001 From: salinasd Date: Sun, 5 Jul 2015 18:30:38 +0000 Subject: Suppression d'une declaration inutile dans skbl geometric git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/compil_fix@679 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 3057def5d61e468d9cb3061234279df8ec96df52 --- .../include/gudhi/Skeleton_blocker_geometric_complex.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/Skeleton_blocker') diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h index 8cea123a..3eff1ba3 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h @@ -79,14 +79,6 @@ public Skeleton_blocker_complex { (*this)[Vertex_handle(current++)].point() = Point(point->begin(), point->end()); } - template - SkeletonBlockerGeometricComplex make_complex_from_top_faces( - SimpleHandleOutputIterator simplex_begin, - SimpleHandleOutputIterator simplex_end, - PointIterator points_begin, - PointIterator points_end, - bool is_flag_complex); - /** * @brief Constructor with a list of simplices. * Points of every vertex are the point constructed with default constructor. -- cgit v1.2.3 From c1786d69f0c19768c15238189ad595f4a2e0e73a Mon Sep 17 00:00:00 2001 From: salinasd Date: Mon, 6 Jul 2015 18:54:34 +0000 Subject: skbl Marc comments git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/compil_fix@684 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b1ed33835e0bffcb1160a90a09cd583889da551e --- .../Skeleton_blocker/Skeleton_blocker_sub_complex.h | 16 +--------------- .../gudhi/Skeleton_blocker_simplifiable_complex.h | 9 ++++++--- 2 files changed, 7 insertions(+), 18 deletions(-) (limited to 'src/Skeleton_blocker') diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h index e906df75..40e26c68 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h @@ -75,25 +75,11 @@ class Skeleton_blocker_sub_complex : public ComplexType { typedef typename ComplexType::Root_simplex_handle Root_simplex_handle; protected: - ///** - //* @brief Returns true iff the simplex formed by all vertices contained in 'addresses_sigma_in_link' - //* but 'vertex_to_be_ignored' is in 'link' - //*/ - /* - template friend bool - proper_face_in_union( - Skeleton_blocker_sub_complex & link, - std::vector > & addresses_sigma_in_link, - int vertex_to_be_ignored);*/ - + /** * @brief Determines whether all proper faces of simplex 'sigma' belong to 'link1' \cup 'link2' * where 'link1' and 'link2' are subcomplexes of the same complex of type ComplexType */ - // template friend bool - // proper_faces_in_union(Skeleton_blocker_simplex & sigma, Skeleton_blocker_sub_complex & link1, Skeleton_blocker_sub_complex & link2){ - // template friend bool - // proper_faces_in_union(Skeleton_blocker_simplex & sigma, Skeleton_blocker_sub_complex & link1, Skeleton_blocker_sub_complex & link2); typedef std::map IdAddressMap; typedef typename IdAddressMap::value_type AddressPair; typedef typename IdAddressMap::iterator IdAddressMapIterator; 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 86a12d90..fa9741b7 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h @@ -208,7 +208,8 @@ void Skeleton_blocker_complex::remove_star(const Simplex_hand } /** - * @brief add a maximal simplex plus all its cofaces. + * @brief add a maximal simplex plus all its cofaces. All vertices lower than the higher vertex of + * sigma must already be present. * @details the simplex must have dimension greater than one (otherwise use add_vertex or add_edge). */ template @@ -338,9 +339,11 @@ void Skeleton_blocker_complex::contract_edge(Vertex_handle a, Vertex_handle b) { assert(this->contains_vertex(a)); assert(this->contains_vertex(b)); - assert(this->contains_edge(a, b)); - // if some blockers passes through 'ab', we remove them. + if(this->contains_edge(a, b)) + this->add_edge(a, b); + + // if some blockers passes through 'ab', we need to remove them. if (!link_condition(a, b)) delete_blockers_around_edge(a, b); -- cgit v1.2.3