summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt14
-rwxr-xr-xscripts/check_code_coverage.sh2
-rw-r--r--src/Hasse_complex/include/gudhi/Hasse_complex.h2
-rw-r--r--src/Persistent_cohomology/example/CMakeLists.txt64
-rw-r--r--src/Persistent_cohomology/example/alpha_shapes_persistence.cpp14
-rw-r--r--src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h18
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h5
-rw-r--r--src/Simplex_tree/test/simplex_tree_unit_test.cpp21
-rw-r--r--src/Skeleton_blocker/test/TestSimplifiable.cpp11
-rw-r--r--src/common/include/gudhi/graph_simplicial_complex.h2
-rw-r--r--src/common/include/gudhi/reader_utils.h2
11 files changed, 91 insertions, 64 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bffba902..d6d0c55f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,12 +15,14 @@ if(MSVC)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -std=c++11 -Wall -Wpedantic -Wsign-compare")
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
endif()
-# BOOST ISSUE result_of vs C++11
-add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
+set(Boost_USE_STATIC_LIBS ON)
+set(Boost_USE_MULTITHREADED ON)
+set(Boost_USE_STATIC_RUNTIME OFF)
+
find_package(Boost)
find_package(GMP)
if(GMP_FOUND)
@@ -56,9 +58,15 @@ endfunction(cpplint_add_tests)
if(NOT Boost_FOUND)
message(FATAL_ERROR "NOTICE: This demo requires Boost and will not be compiled.")
else()
+ # BOOST ISSUE result_of vs C++11
+ add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
+ # BOOST ISSUE with Libraries name resolution under Windows
+ add_definitions(-DBOOST_ALL_NO_LIB)
+
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
+ message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS})
include_directories(src/common/include/)
include_directories(src/Contraction/include/)
diff --git a/scripts/check_code_coverage.sh b/scripts/check_code_coverage.sh
index 8e54def4..ef4aeb76 100755
--- a/scripts/check_code_coverage.sh
+++ b/scripts/check_code_coverage.sh
@@ -7,7 +7,7 @@ UT_DIR_TO_CHECK="$1"
LCOV_DIR=$UT_DIR_TO_CHECK/lcov
COVERAGE_FILE=$LCOV_DIR/coverage.info
LOG_FILE=$LCOV_DIR/coverage.log
-MIN_PERCENT=95
+MIN_PERCENT=86
rm -rf $LCOV_DIR
mkdir $LCOV_DIR
diff --git a/src/Hasse_complex/include/gudhi/Hasse_complex.h b/src/Hasse_complex/include/gudhi/Hasse_complex.h
index 7adfc421..427d9916 100644
--- a/src/Hasse_complex/include/gudhi/Hasse_complex.h
+++ b/src/Hasse_complex/include/gudhi/Hasse_complex.h
@@ -62,7 +62,7 @@ struct Hasse_simplex
* a complex where all codimension 1 incidence
* relations are explicitly encoded.
*
- * \implements FilteredComplex.
+ * \implements FilteredComplex
* \ingroup simplex_tree
*/
template < typename FiltrationValue = double
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt
index 5255988a..31071061 100644
--- a/src/Persistent_cohomology/example/CMakeLists.txt
+++ b/src/Persistent_cohomology/example/CMakeLists.txt
@@ -1,36 +1,38 @@
cmake_minimum_required(VERSION 2.6)
project(GUDHIExPersCohom)
-
-add_executable(rips_persistence rips_persistence.cpp)
-target_link_libraries(rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
-
-add_test(rips_persistence_2 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -m 100)
-add_test(rips_persistence_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 3 -m 100)
-
-add_executable(persistence_from_file persistence_from_file.cpp)
-target_link_libraries(persistence_from_file ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
-add_test(persistence_from_file_3_2_0 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 2 -m 0)
-add_test(persistence_from_file_3_3_100 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 3 -m 100)
-
-if(GMPXX_FOUND AND GMP_FOUND)
- message("GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}")
- message("GMP_LIBRARIES = ${GMP_LIBRARIES}")
-
- add_executable(rips_multifield_persistence rips_multifield_persistence.cpp )
- target_link_libraries(rips_multifield_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
- add_test(rips_multifield_persistence_2_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 3 -m 100)
- add_test(rips_multifield_persistence_2_71 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 71 -m 100)
-
- add_executable ( performance_rips_persistence performance_rips_persistence.cpp )
- target_link_libraries(performance_rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
-
- if(CGAL_FOUND)
- add_definitions(-DDEBUG_TRACES)
- add_executable(alpha_shapes_persistence alpha_shapes_persistence.cpp)
- target_link_libraries(alpha_shapes_persistence ${Boost_SYSTEM_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES} ${CGAL_LIBRARY})
- #add_test(persistence_from_file_3_2_0 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 2 -m 0)
- #add_test(persistence_from_file_3_3_100 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 3 -m 100)
+# problem with Visual Studio link on Boost program_options
+if (!MSVC)
+ add_executable(rips_persistence rips_persistence.cpp)
+ target_link_libraries(rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+
+ add_test(rips_persistence_2 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -m 100)
+ add_test(rips_persistence_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 3 -m 100)
+
+ add_executable(persistence_from_file persistence_from_file.cpp)
+ target_link_libraries(persistence_from_file ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+ add_test(persistence_from_file_3_2_0 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 2 -m 0)
+ add_test(persistence_from_file_3_3_100 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 3 -m 100)
+
+ if(GMPXX_FOUND AND GMP_FOUND)
+ message("GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}")
+ message("GMP_LIBRARIES = ${GMP_LIBRARIES}")
+
+ add_executable(rips_multifield_persistence rips_multifield_persistence.cpp )
+ target_link_libraries(rips_multifield_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
+ add_test(rips_multifield_persistence_2_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 3 -m 100)
+ add_test(rips_multifield_persistence_2_71 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 71 -m 100)
+
+ add_executable ( performance_rips_persistence performance_rips_persistence.cpp )
+ target_link_libraries(performance_rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
+
+ if(CGAL_FOUND)
+ add_definitions(-DDEBUG_TRACES)
+ add_executable(alpha_shapes_persistence alpha_shapes_persistence.cpp)
+ target_link_libraries(alpha_shapes_persistence ${Boost_SYSTEM_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES} ${CGAL_LIBRARY})
+ #add_test(persistence_from_file_3_2_0 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 2 -m 0)
+ #add_test(persistence_from_file_3_3_100 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 3 -m 100)
+ endif()
+
endif()
-
endif()
diff --git a/src/Persistent_cohomology/example/alpha_shapes_persistence.cpp b/src/Persistent_cohomology/example/alpha_shapes_persistence.cpp
index a88a9df0..0591a0ca 100644
--- a/src/Persistent_cohomology/example/alpha_shapes_persistence.cpp
+++ b/src/Persistent_cohomology/example/alpha_shapes_persistence.cpp
@@ -45,7 +45,7 @@ typedef CGAL::Delaunay_triangulation_3<Kernel,Tds> Triangulation_3;
typedef CGAL::Alpha_shape_3<Triangulation_3> Alpha_shape_3;
// From file type definition
-typedef Kernel::Point_3 Point;
+typedef Kernel::Point_3 Point_3;
// filtration with alpha values needed type definition
typedef Alpha_shape_3::FT Alpha_value_type;
@@ -56,7 +56,7 @@ typedef CGAL::Dispatch_output_iterator<
> > Dispatch;
typedef Alpha_shape_3::Cell_handle Cell_handle;
typedef Alpha_shape_3::Facet Facet;
-typedef Alpha_shape_3::Edge Edge;
+typedef Alpha_shape_3::Edge Edge_3;
typedef std::list<Alpha_shape_3::Vertex_handle> Vertex_list;
// gudhi type definition
@@ -94,7 +94,7 @@ Vertex_list from (const Facet& fct)
}
return the_list;
}
-Vertex_list from (const Edge& edg)
+Vertex_list from (const Edge_3& edg)
{
Vertex_list the_list;
for (auto i = 0; i < 4; i++)
@@ -151,14 +151,14 @@ int main (int argc, char * const argv[])
// Read points from file
std::string filegraph = argv[1];
- std::list<Point> lp;
+ std::list<Point_3> lp;
std::ifstream is(filegraph.c_str());
int n;
is >> n;
#ifdef DEBUG_TRACES
std::cout << "Reading " << n << " points " << std::endl;
#endif // DEBUG_TRACES
- Point p;
+ Point_3 p;
for( ; n>0 ; n--) {
is >> p;
lp.push_back(p);
@@ -212,12 +212,12 @@ int main (int argc, char * const argv[])
dim_max=2; // Facet is of dim 2
}
}
- else if (const Edge* edge = CGAL::object_cast<Edge>(&object_iterator))
+ else if (const Edge_3* edge = CGAL::object_cast<Edge_3>(&object_iterator))
{
vertex_list = from(*edge);
count_edges++;
if (dim_max < 1) {
- dim_max=1; // Edge is of dim 1
+ dim_max=1; // Edge_3 is of dim 1
}
}
else if (const Alpha_shape_3::Vertex_handle* vertex = CGAL::object_cast<Alpha_shape_3::Vertex_handle>(&object_iterator))
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
index b5d8003f..bf8c65b9 100644
--- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
+++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
@@ -222,11 +222,8 @@ class Persistent_cohomology {
/** \brief Initializes the Persistent_cohomology class.
*
- * @param[in] cpx Complex for which the persistent homology is compiuted.
+ * @param[in] cpx Complex for which the persistent homology is computed.
cpx is a model of FilteredComplex
- *
- * @param[in] persistence_dim_max if true, the persistent homology for the maximal dimension in the
- * complex is computed. If false, it is ignored. Default is false.
*/
explicit Persistent_cohomology(Complex_ds& cpx)
: cpx_(&cpx),
@@ -708,6 +705,19 @@ class Persistent_cohomology {
}
}
+ void write_output_diagram(std::string diagram_name)
+ {
+ std::ofstream diagram_out(diagram_name.c_str());
+ cmp_intervals_by_length cmp( cpx_ );
+ persistent_pairs_.sort( cmp );
+ for(auto pair : persistent_pairs_)
+ {
+ diagram_out << cpx_->dimension(get<0>(pair)) << " "
+ << cpx_->filtration(get<0>(pair)) << " "
+ << cpx_->filtration(get<1>(pair)) << std::endl;
+ }
+ }
+
private:
/*
* Structure representing a cocycle.
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h
index c866d179..8d5dddce 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h
@@ -39,7 +39,6 @@
namespace Gudhi {
/** \defgroup simplex_tree Filtered Complexes
-/** \defgroup simplex_tree Filtered Complexes
*
* A simplicial complex \f$\mathbf{K}\f$
* on a set of vertices \f$V = \{1, \cdots ,|V|\}\f$ is a collection of simplices
@@ -647,7 +646,7 @@ class Simplex_tree {
typename boost::graph_traits<OneSkeletonGraph>::vertex_iterator v_it,
v_it_end;
- for (tie(v_it, v_it_end) = boost::vertices(skel_graph); v_it != v_it_end;
+ for (std::tie(v_it, v_it_end) = boost::vertices(skel_graph); v_it != v_it_end;
++v_it) {
root_.members_.emplace_hint(
root_.members_.end(), *v_it,
@@ -655,7 +654,7 @@ class Simplex_tree {
}
typename boost::graph_traits<OneSkeletonGraph>::edge_iterator e_it,
e_it_end;
- for (tie(e_it, e_it_end) = boost::edges(skel_graph); e_it != e_it_end;
+ for (std::tie(e_it, e_it_end) = boost::edges(skel_graph); e_it != e_it_end;
++e_it) {
auto u = source(*e_it, skel_graph);
auto v = target(*e_it, skel_graph);
diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
index b44f95a8..6c82586a 100644
--- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
@@ -55,7 +55,7 @@ void test_iterators_on_empty_simplex_tree(typeST& tst)
for( auto f_simplex : tst.filtration_simplex_range() )
{
BOOST_CHECK( false); // shall be empty
- std::cout << "test_simplex_tree_contains - filtration=" << tst.filtration(f_simplex) << std::endl;
+ std::cout << "test_iterators_on_empty_simplex_tree - filtration=" << tst.filtration(f_simplex) << std::endl;
}
}
@@ -125,19 +125,24 @@ BOOST_AUTO_TEST_CASE( simplex_tree_from_file )
simplex_tree_stream.close();
}
-void test_simplex_tree_contains(typeST& simplexTree, typeSimplex simplex, int pos)
+void test_simplex_tree_contains(typeST& simplexTree, typeSimplex& simplex, int pos)
{
- auto f_simplex = simplexTree.filtration_simplex_range().begin();
- f_simplex += pos;
+ auto f_simplex = simplexTree.filtration_simplex_range().begin() + pos;
+
std::cout << "test_simplex_tree_contains - filtration=" << simplexTree.filtration(*f_simplex) << "||" << simplex.second << std::endl;
BOOST_CHECK( AreAlmostTheSame(simplexTree.filtration(*f_simplex),simplex.second) );
- typeVectorVertex::iterator simplexIter = simplex.first.end()-1;
+ //typeVectorVertex::iterator simplexIter = simplex.first.end()-1;
+ int simplexIndex=simplex.first.size()-1;
for( auto vertex : simplexTree.simplex_vertex_range(*f_simplex) )
{
- std::cout << "test_simplex_tree_contains - vertex=" << vertex << "||" << *simplexIter << std::endl;
- BOOST_CHECK( vertex == *simplexIter);
- simplexIter--;
+ //std::cout << "test_simplex_tree_contains - vertex=" << vertex << "||" << *simplexIter << std::endl;
+ //BOOST_CHECK( vertex == *simplexIter);
+ //simplexIter--;
+ std::cout << "test_simplex_tree_contains - vertex=" << vertex << "||" << simplex.first.at(simplexIndex) << std::endl;
+ BOOST_CHECK(vertex == simplex.first.at(simplexIndex));
+ BOOST_CHECK(simplexIndex >= 0);
+ simplexIndex--;
}
}
diff --git a/src/Skeleton_blocker/test/TestSimplifiable.cpp b/src/Skeleton_blocker/test/TestSimplifiable.cpp
index 01767424..78412754 100644
--- a/src/Skeleton_blocker/test/TestSimplifiable.cpp
+++ b/src/Skeleton_blocker/test/TestSimplifiable.cpp
@@ -251,25 +251,28 @@ bool test_add_simplex(){
}
bool test_add_simplex2(){
- Complex complex(5);
+ Complex complex;
build_complete(4,complex);
// Print result
cerr << "initial complex:\n"<< complex.to_string();
cerr <<endl<<endl;
- Complex copy;
+ Complex copy(complex.num_vertices());
std::vector<Simplex_handle> simplices(complex.simplex_range().begin(),complex.simplex_range().end());
sort(simplices.begin(),simplices.end(),[&](const Simplex_handle& s1,const Simplex_handle& s2){
return s1.dimension()<s2.dimension();
});
for(const auto & simplex : simplices){
- if(!copy.contains(simplex))
+ if(!copy.contains(simplex) && simplex.dimension()==1)
+ copy.add_edge(simplex.first_vertex(),simplex.last_vertex());
+ if(!copy.contains(simplex) && simplex.dimension()>1)
copy.add_simplex(simplex);
}
- cerr << "complex after add_simplex:\n"<< complex.to_string();
+ cerr << "complex after add_simplex:\n"<< copy.to_string();
+
return complex.num_blockers()==copy.num_blockers() &&
complex.num_edges()==copy.num_edges() &&
diff --git a/src/common/include/gudhi/graph_simplicial_complex.h b/src/common/include/gudhi/graph_simplicial_complex.h
index e7a8cfe9..1ad9dabd 100644
--- a/src/common/include/gudhi/graph_simplicial_complex.h
+++ b/src/common/include/gudhi/graph_simplicial_complex.h
@@ -86,7 +86,7 @@ Graph_t compute_proximity_graph( PointCloud &points
auto vertex_prop = boost::get(vertex_filtration_t(),skel_graph);
boost::graph_traits<Graph_t>::vertex_iterator vi, vi_end;
- for ( tie(vi, vi_end) = boost::vertices(skel_graph);
+ for ( std::tie(vi, vi_end) = boost::vertices(skel_graph);
vi != vi_end; ++vi )
{ boost::put(vertex_prop, *vi, 0.); }
diff --git a/src/common/include/gudhi/reader_utils.h b/src/common/include/gudhi/reader_utils.h
index 83298f86..ab12c268 100644
--- a/src/common/include/gudhi/reader_utils.h
+++ b/src/common/include/gudhi/reader_utils.h
@@ -115,7 +115,7 @@ read_graph ( std::string file_name )
boost::graph_traits<Graph_t>::vertex_iterator vi, vi_end;
auto v_it = vertices.begin();
- for (tie(vi, vi_end) = boost::vertices(skel_graph); vi != vi_end; ++vi,++v_it)
+ for (std::tie(vi, vi_end) = boost::vertices(skel_graph); vi != vi_end; ++vi,++v_it)
{ boost::put(vertex_prop, *vi, v_it->second); }
return skel_graph;