summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-10-04 19:17:14 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-10-04 19:17:14 +0000
commitddfb5d39a44acdc058fc92ec79b6bceaf7cfa750 (patch)
tree07300896c95adc253a76e9b5c2a3c2e747d60c96
parent4fb5e83405fc505b5f515cf173ba028f699a1444 (diff)
parentbb505d74409fa396c5a9c124c52506a03d6f8dd4 (diff)
Merge last trunk modifications
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@1635 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 8c6dafc85babb49dee556ad60f4fffaf93d6126f
-rw-r--r--CMakeGUDHIVersion.txt2
-rw-r--r--CMakeLists.txt25
-rw-r--r--Conventions.txt76
-rw-r--r--data/points/SO3_10000.off4
-rw-r--r--data/points/SO3_50000.off4
-rw-r--r--data/points/generator/CMakeLists.txt16
-rw-r--r--src/Alpha_complex/doc/Intro_alpha_complex.h6
-rw-r--r--src/Alpha_complex/example/Alpha_complex_from_off.cpp2
-rw-r--r--src/Alpha_complex/example/Alpha_complex_from_points.cpp2
-rw-r--r--src/Alpha_complex/example/CMakeLists.txt18
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex.h12
-rw-r--r--src/Alpha_complex/test/Alpha_complex_unit_test.cpp6
-rw-r--r--src/Alpha_complex/test/CMakeLists.txt15
-rw-r--r--src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h8
-rw-r--r--src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp4
-rw-r--r--src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp4
-rw-r--r--src/Bitmap_cubical_complex/example/CMakeLists.txt2
-rw-r--r--src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp4
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h6
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h6
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h6
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h6
-rw-r--r--src/Bitmap_cubical_complex/test/Bitmap_test.cpp8
-rw-r--r--src/Bitmap_cubical_complex/test/CMakeLists.txt2
-rw-r--r--src/Bottleneck/example/CMakeLists.txt2
-rw-r--r--src/Bottleneck/test/CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt24
-rw-r--r--src/Contraction/example/CMakeLists.txt2
-rw-r--r--src/Contraction/example/Garland_heckbert.cpp3
-rw-r--r--src/Contraction/example/Rips_contraction.cpp3
-rw-r--r--src/Contraction/include/gudhi/Edge_contraction.h4
-rw-r--r--src/Contraction/include/gudhi/Skeleton_blocker_contractor.h2
-rw-r--r--src/Doxyfile18
-rw-r--r--src/GudhUI/model/Complex_typedefs.h2
-rw-r--r--src/GudhUI/model/Model.h4
-rw-r--r--src/GudhUI/utils/Edge_contractor.h2
-rw-r--r--src/GudhUI/utils/Furthest_point_epsilon_net.h2
-rw-r--r--src/GudhUI/view/FirstCoordProjector.h6
-rw-r--r--src/Persistent_cohomology/doc/Intro_persistent_cohomology.h64
-rw-r--r--src/Persistent_cohomology/example/CMakeLists.txt86
-rw-r--r--src/Persistent_cohomology/example/alpha_complex_persistence.cpp4
-rw-r--r--src/Persistent_cohomology/example/custom_persistence_sort.cpp2
-rw-r--r--src/Persistent_cohomology/example/plain_homology.cpp3
-rw-r--r--src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h6
-rw-r--r--src/Persistent_cohomology/test/CMakeLists.txt2
-rw-r--r--src/Persistent_cohomology/test/betti_numbers_unit_test.cpp4
-rw-r--r--src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp45
-rw-r--r--src/Simplex_tree/concept/SimplexKey.h2
-rw-r--r--src/Simplex_tree/concept/SimplexTreeOptions.h2
-rw-r--r--src/Simplex_tree/doc/Intro_simplex_tree.h85
-rw-r--r--src/Simplex_tree/example/CMakeLists.txt2
-rw-r--r--src/Simplex_tree/example/README4
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h53
-rw-r--r--src/Simplex_tree/test/CMakeLists.txt2
-rw-r--r--src/Simplex_tree/test/simplex_tree_unit_test.cpp16
-rw-r--r--src/Skeleton_blocker/concept/SkeletonBlockerDS.h218
-rw-r--r--src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h122
-rw-r--r--src/Skeleton_blocker/example/CMakeLists.txt2
-rw-r--r--src/Skeleton_blocker/example/Skeleton_blocker_from_simplices.cpp11
-rw-r--r--src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp10
-rw-r--r--src/Skeleton_blocker/example/Skeleton_blocker_link.cpp22
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h225
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h59
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h20
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h17
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h19
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h44
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h18
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h55
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Top_faces.h11
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h15
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h9
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_edges_iterators.h9
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_iterators.h2
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h44
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h20
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_vertices_iterators.h18
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h39
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h9
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker_link_complex.h36
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h19
-rw-r--r--src/Skeleton_blocker/test/CMakeLists.txt29
-rw-r--r--src/Skeleton_blocker/test/TestGeometricComplex.cpp118
-rw-r--r--src/Skeleton_blocker/test/test_skeleton_blocker_complex.cpp (renamed from src/Skeleton_blocker/test/TestSkeletonBlockerComplex.cpp)601
-rw-r--r--src/Skeleton_blocker/test/test_skeleton_blocker_geometric_complex.cpp125
-rw-r--r--src/Skeleton_blocker/test/test_skeleton_blocker_simplifiable.cpp (renamed from src/Skeleton_blocker/test/TestSimplifiable.cpp)290
-rw-r--r--src/Witness_complex/example/CMakeLists.txt34
-rw-r--r--src/Witness_complex/test/CMakeLists.txt2
-rw-r--r--src/cmake/modules/FindQGLViewer.cmake2
-rw-r--r--src/cmake/modules/GUDHI_doxygen_target.txt11
-rw-r--r--src/cmake/modules/GUDHI_user_version_target.txt115
-rw-r--r--src/common/doc/header.html3
-rw-r--r--src/common/doc/main_page.h56
-rw-r--r--src/common/example/CMakeLists.txt33
-rw-r--r--src/common/example/example_CGAL_3D_points_off_reader.cpp (renamed from src/common/example/CGAL_3D_points_off_reader.cpp)0
-rw-r--r--src/common/example/example_CGAL_points_off_reader.cpp (renamed from src/common/example/CGAL_points_off_reader.cpp)2
-rw-r--r--src/common/example/example_vector_double_points_off_reader.cpp41
-rw-r--r--src/common/include/gudhi/Points_3D_off_io.h4
-rw-r--r--src/common/include/gudhi/Points_off_io.h13
-rw-r--r--src/common/include/gudhi/Test.h105
-rw-r--r--src/common/test/CMakeLists.txt33
-rw-r--r--src/common/test/test_points_off_reader.cpp (renamed from src/common/test/points_off_reader_unit_test.cpp)21
102 files changed, 1692 insertions, 1721 deletions
diff --git a/CMakeGUDHIVersion.txt b/CMakeGUDHIVersion.txt
index 20767813..a00ae1b2 100644
--- a/CMakeGUDHIVersion.txt
+++ b/CMakeGUDHIVersion.txt
@@ -1,6 +1,6 @@
set (GUDHI_MAJOR_VERSION 1)
set (GUDHI_MINOR_VERSION 3)
-set (GUDHI_PATCH_VERSION 0)
+set (GUDHI_PATCH_VERSION 1)
set(GUDHI_VERSION ${GUDHI_MAJOR_VERSION}.${GUDHI_MINOR_VERSION}.${GUDHI_PATCH_VERSION})
message(STATUS "GUDHI version : ${GUDHI_VERSION}")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e22be07b..d7078489 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,11 +18,18 @@ else()
enable_testing()
+ # For "make user_version"
+ include(${CMAKE_MODULE_PATH}/GUDHI_user_version_target.txt)
+ # For "make doxygen"
+ include(${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt)
+
find_package(GMP)
if(GMP_FOUND)
+ message(STATUS "GMP_LIBRARIES = ${GMP_LIBRARIES}")
INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR})
find_package(GMPXX)
if(GMPXX_FOUND)
+ message(STATUS "GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}")
INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR})
endif()
endif()
@@ -40,6 +47,7 @@ else()
unset(CGAL_FOUND)
endif()
if(CGAL_FOUND)
+ message(STATUS "CGAL version: ${CGAL_VERSION}.")
include( ${CGAL_USE_FILE} )
endif()
@@ -47,7 +55,7 @@ else()
# Turn off some VC++ warnings
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} -std=c++11 -Wall -Wpedantic -Wsign-compare")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic")
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
@@ -69,6 +77,13 @@ else()
add_definitions(-DGUDHI_USE_TBB)
endif()
+ find_package(Eigen3 3.1.0)
+ if (EIGEN3_FOUND)
+ message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
+ include( ${EIGEN3_USE_FILE} )
+ #include_directories (BEFORE "../../include")
+ endif (EIGEN3_FOUND)
+
# Required programs for unitary tests purpose
FIND_PROGRAM( GCOVR_PATH gcovr )
if (GCOVR_PATH)
@@ -79,10 +94,10 @@ else()
if (GPROF_PATH)
message("gprof found in ${GPROF_PATH}")
endif()
-FIND_PROGRAM( DIFF_PATH diff )
-if (DIFF_PATH)
- message("diff found in ${DIFF_PATH}")
-endif()
+ FIND_PROGRAM( DIFF_PATH diff )
+ if (DIFF_PATH)
+ message("diff found in ${DIFF_PATH}")
+ endif()
# BOOST ISSUE result_of vs C++11
add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
diff --git a/Conventions.txt b/Conventions.txt
index f7d6831e..e4ae7925 100644
--- a/Conventions.txt
+++ b/Conventions.txt
@@ -1,75 +1 @@
-Please read this convention before adding your package(s) into Gudhi library.
-
-
-Compilation:
-*********************
-CMake is used for compilation purpose.
-
-
-
-Naming conventions:
-*********************
-
-All headers are named *.h and all sources are named *.cpp.
-Concepts are named with camel case starting with uppercase that is "PersistentHomology.h"
-for instance for the concept of Persitence homology.
-Classes and methods are named with underscore separator that is :
-- "Skeleton_blocker_contractor.h" for the class Skeleton_blocker_contractor
-- "int num_vertices() const" for a method
-
-
-Package organization:
-*********************
-The Gudhi directories are organised by 2 manners (Internal for svn developpers and User for external User/Developper).
-
-Internal:
---------
-
-src/common/concept/common_concept.h
- doc/MainPage.h
- include/gudhi/io.h
- ....h
- package1/concept/package1_concept1.h
- ....h
- doc/Intro_package.h
- include/gudhi/*.h
- source/*.cpp
- test/*.cpp
- CMakeLists.txt
- example/*.cpp
- CMakeLists.txt
- package2/...
- ...
- cmake/modules/*.cmake
-
-data/points/kl.txt
- sphere_3D.txt
- ....txt
- meshes/sphere.off
- Paris.off
-scripts/generate_version.sh
- ....sh
- ....py
-Doxyfile
-CMakeLists.txt
-Version.txt
-Conventions.txt
-README
-COPYING
-
-User:
---------
-
-include/gudhi/*.h
-source/*.cpp
-example/package1/*.cpp
- CMakeLists.txt
- package2/*.cpp
- CMakeLists.txt
- ...
-cmake/modules/*.cmake
-CMakeLists.txt
-Version.txt
-Conventions.txt
-README
-COPYING
+Please refer to the Wiki: https://gforge.inria.fr/plugins/mediawiki/wiki/gudhi/index.php/Conventions \ No newline at end of file
diff --git a/data/points/SO3_10000.off b/data/points/SO3_10000.off
index fbf9b273..3f2a3cda 100644
--- a/data/points/SO3_10000.off
+++ b/data/points/SO3_10000.off
@@ -1,5 +1,5 @@
-OFF
-10000 1 0
+nOFF
+9 10000 1 0
2.08167e-17 0 -1 -0.500001 0.866026 0 0.866026 0.500001 -2.08167e-17
0 0 -1 0.500001 -0.866026 0 -0.866026 -0.500001 0
0 0 -1 -1 0 0 0 1 0
diff --git a/data/points/SO3_50000.off b/data/points/SO3_50000.off
index 635e8988..9b23a78f 100644
--- a/data/points/SO3_50000.off
+++ b/data/points/SO3_50000.off
@@ -1,5 +1,5 @@
-OFF
-50000 1 0
+nOFF
+9 50000 1 0
2.08167e-17 0 -1 -0.500001 0.866026 0 0.866026 0.500001 -2.08167e-17
0 0 -1 0.500001 -0.866026 0 -0.866026 -0.500001 0
0 0 -1 -1 0 0 0 1 0
diff --git a/data/points/generator/CMakeLists.txt b/data/points/generator/CMakeLists.txt
index f892aa50..f559610c 100644
--- a/data/points/generator/CMakeLists.txt
+++ b/data/points/generator/CMakeLists.txt
@@ -1,15 +1,9 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIPointsGenerator)
+project(Data_points_generator)
if(CGAL_FOUND)
if (NOT CGAL_VERSION VERSION_LESS 4.6.0)
- message(STATUS "CGAL version: ${CGAL_VERSION}.")
-
- find_package(Eigen3 3.1.0)
if (EIGEN3_FOUND)
- include( ${EIGEN3_USE_FILE} )
- include_directories (BEFORE "../../include")
-
add_executable ( hypergenerator hypergenerator.cpp )
target_link_libraries(hypergenerator ${Boost_SYSTEM_LIBRARY})
add_test(hypergenerator_on_sphere_3000_10_5.0 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator on sphere onSphere.off 3000 10 5.0)
@@ -19,8 +13,6 @@ if(CGAL_FOUND)
# on cube is not available in CGAL
add_test(hypergenerator_in_cube_7000_12_10.8 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in cube inCube.off 7000 12 10.8)
add_test(hypergenerator_in_cube_50000_2 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in cube inCube.off 50000 3)
- endif()
- else()
- message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile hypergenerator. Version 4.6.0 is required.")
- endif ()
-endif()
+ endif(EIGEN3_FOUND)
+ endif(NOT CGAL_VERSION VERSION_LESS 4.6.0)
+endif(CGAL_FOUND)
diff --git a/src/Alpha_complex/doc/Intro_alpha_complex.h b/src/Alpha_complex/doc/Intro_alpha_complex.h
index 226bb257..f3126169 100644
--- a/src/Alpha_complex/doc/Intro_alpha_complex.h
+++ b/src/Alpha_complex/doc/Intro_alpha_complex.h
@@ -26,7 +26,7 @@
// needs namespace for Doxygen to link on classes
namespace Gudhi {
// needs namespace for Doxygen to link on classes
-namespace alphacomplex {
+namespace alpha_complex {
/** \defgroup alpha_complex Alpha complex
*
@@ -161,7 +161,9 @@ namespace alphacomplex {
*/
/** @} */ // end defgroup alpha_complex
-} // namespace alphacomplex
+} // namespace alpha_complex
+
+namespace alphacomplex = alpha_complex;
} // namespace Gudhi
diff --git a/src/Alpha_complex/example/Alpha_complex_from_off.cpp b/src/Alpha_complex/example/Alpha_complex_from_off.cpp
index 963ef5ca..7836d59a 100644
--- a/src/Alpha_complex/example/Alpha_complex_from_off.cpp
+++ b/src/Alpha_complex/example/Alpha_complex_from_off.cpp
@@ -21,7 +21,7 @@ int main(int argc, char **argv) {
// Init of an alpha complex from an OFF file
// ----------------------------------------------------------------------------
typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Kernel;
- Gudhi::alphacomplex::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, alpha_square_max_value);
std::streambuf* streambufffer;
std::ofstream ouput_file_stream;
diff --git a/src/Alpha_complex/example/Alpha_complex_from_points.cpp b/src/Alpha_complex/example/Alpha_complex_from_points.cpp
index cd17af1e..49f77276 100644
--- a/src/Alpha_complex/example/Alpha_complex_from_points.cpp
+++ b/src/Alpha_complex/example/Alpha_complex_from_points.cpp
@@ -40,7 +40,7 @@ int main(int argc, char **argv) {
// ----------------------------------------------------------------------------
// Init of an alpha complex from the list of points
// ----------------------------------------------------------------------------
- Gudhi::alphacomplex::Alpha_complex<Kernel> alpha_complex_from_points(points, alpha_square_max_value);
+ Gudhi::alpha_complex::Alpha_complex<Kernel> alpha_complex_from_points(points, alpha_square_max_value);
// ----------------------------------------------------------------------------
// Display information about the alpha complex
diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt
index c1439f70..71a95d61 100644
--- a/src/Alpha_complex/example/CMakeLists.txt
+++ b/src/Alpha_complex/example/CMakeLists.txt
@@ -1,17 +1,11 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIAlphaShapesExample)
+project(Alpha_complex_examples)
# need CGAL 4.7
# cmake -DCGAL_DIR=~/workspace/CGAL-4.7-Ic-41 ../../..
if(CGAL_FOUND)
if (NOT CGAL_VERSION VERSION_LESS 4.7.0)
- message(STATUS "CGAL version: ${CGAL_VERSION}.")
-
- find_package(Eigen3 3.1.0)
if (EIGEN3_FOUND)
- message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
- include( ${EIGEN3_USE_FILE} )
-
add_executable ( alphapoints Alpha_complex_from_points.cpp )
target_link_libraries(alphapoints ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY})
add_executable ( alphaoffreader Alpha_complex_from_off.cpp )
@@ -34,10 +28,6 @@ if(CGAL_FOUND)
add_test(alphaoffreader_doc_60_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_60.txt)
add_test(alphaoffreader_doc_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt)
endif()
- else()
- message(WARNING "Eigen3 not found. Version 3.1.0 is required for Alpha shapes feature.")
- endif()
- else()
- message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Alpha shapes feature. Version 4.6.0 is required.")
- endif ()
-endif()
+ endif(EIGEN3_FOUND)
+ endif(NOT CGAL_VERSION VERSION_LESS 4.7.0)
+endif(CGAL_FOUND)
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h
index a1900cb9..2c95ceb4 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h
@@ -48,7 +48,7 @@
namespace Gudhi {
-namespace alphacomplex {
+namespace alpha_complex {
/**
* \class Alpha_complex Alpha_complex.h gudhi/Alpha_complex.h
@@ -309,7 +309,7 @@ class Alpha_complex : public Simplex_tree<> {
std::cout << std::endl;
#endif // DEBUG_TRACES
// ### If filt(Sigma) is NaN : filt(Sigma) = alpha(Sigma)
- if (isnan(filtration(f_simplex))) {
+ if (std::isnan(filtration(f_simplex))) {
Filtration_value alpha_complex_filtration = 0.0;
// No need to compute squared_radius on a single point - alpha is 0.0
if (f_simplex_dim > 0) {
@@ -352,10 +352,10 @@ class Alpha_complex : public Simplex_tree<> {
std::cout << vertex << " ";
}
std::cout << "is a face of Sigma\n";
- std::cout << " | isnan(filtration(Tau)=" << isnan(filtration(f_boundary)) << std::endl;
+ std::cout << " | isnan(filtration(Tau)=" << std::isnan(filtration(f_boundary)) << std::endl;
#endif // DEBUG_TRACES
// ### If filt(Tau) is not NaN
- if (!isnan(filtration(f_boundary))) {
+ if (!std::isnan(filtration(f_boundary))) {
// ### filt(Tau) = fmin(filt(Tau), filt(Sigma))
Filtration_value alpha_complex_filtration = fmin(filtration(f_boundary), filtration(f_simplex));
assign_filtration(f_boundary, alpha_complex_filtration);
@@ -410,7 +410,9 @@ class Alpha_complex : public Simplex_tree<> {
}
};
-} // namespace alphacomplex
+} // namespace alpha_complex
+
+namespace alphacomplex = alpha_complex;
} // namespace Gudhi
diff --git a/src/Alpha_complex/test/Alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_unit_test.cpp
index 80b39924..4d7bf622 100644
--- a/src/Alpha_complex/test/Alpha_complex_unit_test.cpp
+++ b/src/Alpha_complex/test/Alpha_complex_unit_test.cpp
@@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(ALPHA_DOC_OFF_file) {
std::cout << "========== OFF FILE NAME = " << off_file_name << " - alpha²=" <<
max_alpha_square_value << "==========" << std::endl;
- Gudhi::alphacomplex::Alpha_complex<Kernel_d> alpha_complex_from_file(off_file_name, max_alpha_square_value);
+ Gudhi::alpha_complex::Alpha_complex<Kernel_d> alpha_complex_from_file(off_file_name, max_alpha_square_value);
const int DIMENSION = 2;
std::cout << "alpha_complex_from_file.dimension()=" << alpha_complex_from_file.dimension() << std::endl;
@@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(ALPHA_DOC_OFF_file_filtered) {
max_alpha_square_value << "==========" << std::endl;
// Use of the default dynamic kernel
- Gudhi::alphacomplex::Alpha_complex<> alpha_complex_from_file(off_file_name, max_alpha_square_value);
+ Gudhi::alpha_complex::Alpha_complex<> alpha_complex_from_file(off_file_name, max_alpha_square_value);
const int DIMENSION = 2;
std::cout << "alpha_complex_from_file.dimension()=" << alpha_complex_from_file.dimension() << std::endl;
@@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_from_points) {
// ----------------------------------------------------------------------------
// Init of an alpha complex from the list of points
// ----------------------------------------------------------------------------
- Gudhi::alphacomplex::Alpha_complex<Kernel_s> alpha_complex_from_points(points);
+ Gudhi::alpha_complex::Alpha_complex<Kernel_s> alpha_complex_from_points(points);
std::cout << "========== Alpha_complex_from_points ==========" << std::endl;
diff --git a/src/Alpha_complex/test/CMakeLists.txt b/src/Alpha_complex/test/CMakeLists.txt
index f8d6d789..b0723a41 100644
--- a/src/Alpha_complex/test/CMakeLists.txt
+++ b/src/Alpha_complex/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIAlphaComplexTest)
+project(Alpha_complex_tests)
if (GCOVR_PATH)
# for gcovr to make coverage reports - Corbera Jenkins plugin
@@ -14,16 +14,9 @@ endif()
# cmake -DCGAL_DIR=~/workspace/CGAL-4.7-Ic-41 ../../..
if(CGAL_FOUND)
if (NOT CGAL_VERSION VERSION_LESS 4.7.0)
- message(STATUS "CGAL version: ${CGAL_VERSION}.")
-
- find_package(Eigen3 3.1.0)
if (EIGEN3_FOUND)
- message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
- include( ${EIGEN3_USE_FILE} )
- include_directories (BEFORE "../../include")
-
add_executable ( AlphaComplexUT Alpha_complex_unit_test.cpp )
- target_link_libraries(AlphaComplexUT ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+ target_link_libraries(AlphaComplexUT ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
if (TBB_FOUND)
target_link_libraries(AlphaComplexUT ${TBB_LIBRARIES})
endif()
@@ -36,10 +29,10 @@ if(CGAL_FOUND)
--log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/AlphaComplexUT.xml --log_level=test_suite --report_level=no)
else()
- message(WARNING "Eigen3 not found. Version 3.1.0 is required for Alpha complex feature.")
+ message(WARNING "Eigen3 not found. Version 3.1.0 is required for Alpha complex unitary tests.")
endif()
else()
- message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Alpha complex feature. Version 4.6.0 is required.")
+ message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Alpha complex unitary tests. Version 4.7.0 is required.")
endif ()
endif()
diff --git a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h
index 550e90b9..5963caa3 100644
--- a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h
+++ b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h
@@ -26,7 +26,7 @@
namespace Gudhi {
-namespace Cubical_complex {
+namespace cubical_complex {
/** \defgroup cubical_complex Cubical complex
*
@@ -63,7 +63,7 @@ namespace Cubical_complex {
* For further details and theory of cubical complexes, please consult \cite kaczynski2004computational as well as the
* following paper \cite peikert2012topological .
*
- * \section datastructure Data structure.
+ * \section cubicalcomplexdatastructure Data structure.
*
* The implementation of Cubical complex provides a representation of complexes that occupy a rectangular region in
* \f$\mathbb{R}^n\f$. This extra assumption allows for a memory efficient way of storing cubical complexes in a form
@@ -150,7 +150,9 @@ namespace Cubical_complex {
*/
/** @} */ // end defgroup cubical_complex
-} // namespace Cubical_complex
+} // namespace cubical_complex
+
+namespace Cubical_complex = cubical_complex;
} // namespace Gudhi
diff --git a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp
index 7c7e8ac5..e6bc6648 100644
--- a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp
+++ b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp
@@ -47,8 +47,8 @@ int main(int argc, char** argv) {
return 1;
}
- typedef Gudhi::Cubical_complex::Bitmap_cubical_complex_base<double> Bitmap_cubical_complex_base;
- typedef Gudhi::Cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_base> Bitmap_cubical_complex;
+ typedef Gudhi::cubical_complex::Bitmap_cubical_complex_base<double> Bitmap_cubical_complex_base;
+ typedef Gudhi::cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_base> Bitmap_cubical_complex;
typedef Gudhi::persistent_cohomology::Field_Zp Field_Zp;
typedef Gudhi::persistent_cohomology::Persistent_cohomology<Bitmap_cubical_complex, Field_Zp> Persistent_cohomology;
diff --git a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
index 2c5d7fd3..839a4c89 100644
--- a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
+++ b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
@@ -49,8 +49,8 @@ int main(int argc, char** argv) {
return 1;
}
- typedef Gudhi::Cubical_complex::Bitmap_cubical_complex_periodic_boundary_conditions_base<double> Bitmap_base;
- typedef Gudhi::Cubical_complex::Bitmap_cubical_complex< Bitmap_base > Bitmap_cubical_complex;
+ typedef Gudhi::cubical_complex::Bitmap_cubical_complex_periodic_boundary_conditions_base<double> Bitmap_base;
+ typedef Gudhi::cubical_complex::Bitmap_cubical_complex< Bitmap_base > Bitmap_cubical_complex;
Bitmap_cubical_complex b(argv[1]);
diff --git a/src/Bitmap_cubical_complex/example/CMakeLists.txt b/src/Bitmap_cubical_complex/example/CMakeLists.txt
index 48b5d22f..2fddc514 100644
--- a/src/Bitmap_cubical_complex/example/CMakeLists.txt
+++ b/src/Bitmap_cubical_complex/example/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIBitmap)
+project(Bitmap_cubical_complex_examples)
add_executable ( Bitmap_cubical_complex Bitmap_cubical_complex.cpp )
target_link_libraries(Bitmap_cubical_complex ${Boost_SYSTEM_LIBRARY})
diff --git a/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp b/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp
index 416ad8f2..16ad65a0 100644
--- a/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp
+++ b/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp
@@ -61,8 +61,8 @@ int main(int argc, char** argv) {
data.push_back(rand() / static_cast<double>(RAND_MAX));
}
- typedef Gudhi::Cubical_complex::Bitmap_cubical_complex_base<double> Bitmap_cubical_complex_base;
- typedef Gudhi::Cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_base> Bitmap_cubical_complex;
+ typedef Gudhi::cubical_complex::Bitmap_cubical_complex_base<double> Bitmap_cubical_complex_base;
+ typedef Gudhi::cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_base> Bitmap_cubical_complex;
Bitmap_cubical_complex b(sizes, data);
// Compute the persistence diagram of the complex
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
index 56fa297c..5a87b9b8 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
@@ -38,7 +38,7 @@
namespace Gudhi {
-namespace Cubical_complex {
+namespace cubical_complex {
// global variable, was used just for debugging.
const bool globalDbg = false;
@@ -586,7 +586,9 @@ class is_before_in_filtration {
Bitmap_cubical_complex<T>* CC_;
};
-} // namespace Cubical_complex
+} // namespace cubical_complex
+
+namespace Cubical_complex = cubical_complex;
} // namespace Gudhi
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h
index 3a8c3988..4b072f10 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h
@@ -28,7 +28,7 @@
namespace Gudhi {
-namespace Cubical_complex {
+namespace cubical_complex {
/**
* @brief This is an implementation of a counter being a vector of integers.
@@ -135,7 +135,9 @@ class counter {
std::vector< unsigned > current;
};
-} // namespace Cubical_complex
+} // namespace cubical_complex
+
+namespace Cubical_complex = cubical_complex;
} // namespace Gudhi
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
index 2f74ba9e..0442ac34 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
@@ -36,7 +36,7 @@
namespace Gudhi {
-namespace Cubical_complex {
+namespace cubical_complex {
/**
* @brief Cubical complex represented as a bitmap, class with basic implementation.
@@ -808,7 +808,9 @@ bool compareFirstElementsOfTuples(const std::pair< std::pair< T, size_t >, char
}
}
-} // namespace Cubical_complex
+} // namespace cubical_complex
+
+namespace Cubical_complex = cubical_complex;
} // namespace Gudhi
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h
index 0d0f2f84..c3cc93dd 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h
@@ -31,7 +31,7 @@
namespace Gudhi {
-namespace Cubical_complex {
+namespace cubical_complex {
// in this class, we are storing all the elements which are in normal bitmap (i.e. the bitmap without the periodic
// boundary conditions). But, we set up the iterators and the procedures to compute boundary and coboundary in the way
@@ -299,7 +299,9 @@ std::vector< size_t > Bitmap_cubical_complex_periodic_boundary_conditions_base<T
return coboundary_elements;
}
-} // namespace Cubical_complex
+} // namespace cubical_complex
+
+namespace Cubical_complex = cubical_complex;
} // namespace Gudhi
diff --git a/src/Bitmap_cubical_complex/test/Bitmap_test.cpp b/src/Bitmap_cubical_complex/test/Bitmap_test.cpp
index a9162cee..db90eb94 100644
--- a/src/Bitmap_cubical_complex/test/Bitmap_test.cpp
+++ b/src/Bitmap_cubical_complex/test/Bitmap_test.cpp
@@ -34,12 +34,12 @@
#include <vector>
-typedef Gudhi::Cubical_complex::Bitmap_cubical_complex_base<double> Bitmap_cubical_complex_base;
-typedef Gudhi::Cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_base> Bitmap_cubical_complex;
+typedef Gudhi::cubical_complex::Bitmap_cubical_complex_base<double> Bitmap_cubical_complex_base;
+typedef Gudhi::cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_base> Bitmap_cubical_complex;
-typedef Gudhi::Cubical_complex::Bitmap_cubical_complex_periodic_boundary_conditions_base<double>
+typedef Gudhi::cubical_complex::Bitmap_cubical_complex_periodic_boundary_conditions_base<double>
Bitmap_cubical_complex_periodic_boundary_conditions_base;
-typedef Gudhi::Cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_periodic_boundary_conditions_base>
+typedef Gudhi::cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_periodic_boundary_conditions_base>
Bitmap_cubical_complex_periodic_boundary_conditions;
BOOST_AUTO_TEST_CASE(check_dimension) {
diff --git a/src/Bitmap_cubical_complex/test/CMakeLists.txt b/src/Bitmap_cubical_complex/test/CMakeLists.txt
index d8c44035..daf0e14f 100644
--- a/src/Bitmap_cubical_complex/test/CMakeLists.txt
+++ b/src/Bitmap_cubical_complex/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIBitmapCCUT)
+project(Bitmap_cubical_complex_tests)
if (GCOVR_PATH)
# for gcovr to make coverage reports - Corbera Jenkins plugin
diff --git a/src/Bottleneck/example/CMakeLists.txt b/src/Bottleneck/example/CMakeLists.txt
index 2ff009c4..77797202 100644
--- a/src/Bottleneck/example/CMakeLists.txt
+++ b/src/Bottleneck/example/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIBottleneckExample)
+project(Bottleneck_examples)
add_executable ( RandomDiagrams random_diagrams.cpp )
add_test(RandomDiagrams ${CMAKE_CURRENT_BINARY_DIR}/RandomDiagrams)
diff --git a/src/Bottleneck/test/CMakeLists.txt b/src/Bottleneck/test/CMakeLists.txt
index ad63c080..9d88ab25 100644
--- a/src/Bottleneck/test/CMakeLists.txt
+++ b/src/Bottleneck/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIBottleneckUT)
+project(Bottleneck_tests)
if (GCOVR_PATH)
# for gcovr to make coverage reports - Corbera Jenkins plugin
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fcf38a51..337079b1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -15,11 +15,17 @@ if(NOT Boost_FOUND)
message(FATAL_ERROR "NOTICE: This demo requires Boost and will not be compiled.")
else()
+ # For "make doxygen"
+ set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR})
+ include(${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt)
+
find_package(GMP)
if(GMP_FOUND)
+ message(STATUS "GMP_LIBRARIES = ${GMP_LIBRARIES}")
INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR})
find_package(GMPXX)
if(GMPXX_FOUND)
+ message(STATUS "GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}")
INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR})
endif()
endif()
@@ -30,13 +36,16 @@ else()
# A fix would be to use https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
# or even better https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD.html
# but it implies to use cmake version 3.1 at least.
- find_package(CGAL)
+
+ # find CGAL in QUIET mode for cmake to be less verbose when CGAL is not found.
+ find_package(CGAL QUIET)
# Only CGAL versions > 4.4 supports what Gudhi uses from CGAL
- if (CGAL_VERSION VERSION_LESS 4.4.0)
+ if (CGAL_VERSION VERSION_LESS 4.4.0 AND CGAL_FOUND)
message("CGAL version ${CGAL_VERSION} is considered too old to be used by Gudhi.")
unset(CGAL_FOUND)
- endif()
+ endif(CGAL_VERSION VERSION_LESS 4.4.0 AND CGAL_FOUND)
if(CGAL_FOUND)
+ message(STATUS "CGAL version: ${CGAL_VERSION}.")
include( ${CGAL_USE_FILE} )
endif()
@@ -44,7 +53,7 @@ else()
# Turn off some VC++ warnings
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} -std=c++11 -Wall -Wpedantic -Wsign-compare")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic")
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
@@ -66,6 +75,13 @@ else()
add_definitions(-DGUDHI_USE_TBB)
endif()
+ find_package(Eigen3 3.1.0)
+ if (EIGEN3_FOUND)
+ message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
+ include( ${EIGEN3_USE_FILE} )
+ #include_directories (BEFORE "../../include")
+ endif (EIGEN3_FOUND)
+
# BOOST ISSUE result_of vs C++11
add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
# BOOST ISSUE with Libraries name resolution under Windows
diff --git a/src/Contraction/example/CMakeLists.txt b/src/Contraction/example/CMakeLists.txt
index 00dea98d..4c09a0a7 100644
--- a/src/Contraction/example/CMakeLists.txt
+++ b/src/Contraction/example/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIskbl)
+project(Contraction_examples)
add_executable(RipsContraction Rips_contraction.cpp)
diff --git a/src/Contraction/example/Garland_heckbert.cpp b/src/Contraction/example/Garland_heckbert.cpp
index b545a066..5347830c 100644
--- a/src/Contraction/example/Garland_heckbert.cpp
+++ b/src/Contraction/example/Garland_heckbert.cpp
@@ -35,9 +35,8 @@
#include "Garland_heckbert/Error_quadric.h"
-using namespace std;
using namespace Gudhi;
-using namespace skbl;
+using namespace skeleton_blocker;
using namespace contraction;
struct Geometry_trait {
diff --git a/src/Contraction/example/Rips_contraction.cpp b/src/Contraction/example/Rips_contraction.cpp
index f80cc2dc..7f19e239 100644
--- a/src/Contraction/example/Rips_contraction.cpp
+++ b/src/Contraction/example/Rips_contraction.cpp
@@ -27,9 +27,8 @@
#include <boost/timer/timer.hpp>
#include <iostream>
-using namespace std;
using namespace Gudhi;
-using namespace skbl;
+using namespace skeleton_blocker;
using namespace contraction;
struct Geometry_trait {
diff --git a/src/Contraction/include/gudhi/Edge_contraction.h b/src/Contraction/include/gudhi/Edge_contraction.h
index 1b2cdee9..61f2d945 100644
--- a/src/Contraction/include/gudhi/Edge_contraction.h
+++ b/src/Contraction/include/gudhi/Edge_contraction.h
@@ -41,7 +41,7 @@ namespace contraction {
\author David Salinas
-\section Introduction
+\section edgecontractionintroduction Introduction
The purpose of this package is to offer a user-friendly interface for edge contraction simplification of huge simplicial complexes.
It uses the \ref skbl data-structure whose size remains small during simplification
@@ -127,7 +127,7 @@ while ensuring its homotopy type is preserved during the contraction (edge are c
using namespace std;
using namespace Gudhi;
-using namespace skbl;
+using namespace skeleton_blocker;
using namespace contraction;
struct Geometry_trait{
diff --git a/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h b/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h
index f650473a..df884c93 100644
--- a/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h
+++ b/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h
@@ -100,7 +100,7 @@ Contraction_visitor<Profile>* make_remove_popable_blockers_visitor() {
*
*/
template<class GeometricSimplifiableComplex, class EdgeProfile = Edge_profile<GeometricSimplifiableComplex>>
-class Skeleton_blocker_contractor : private skbl::Dummy_complex_visitor<
+class Skeleton_blocker_contractor : private skeleton_blocker::Dummy_complex_visitor<
typename GeometricSimplifiableComplex::Vertex_handle> {
GeometricSimplifiableComplex& complex_;
diff --git a/src/Doxyfile b/src/Doxyfile
index 6ddfb55d..dd9a33fb 100644
--- a/src/Doxyfile
+++ b/src/Doxyfile
@@ -38,7 +38,7 @@ PROJECT_NAME = "GUDHI"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = "1.3.0"
+PROJECT_NUMBER = "1.3.1"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -782,7 +782,9 @@ RECURSIVE = YES
EXCLUDE = data/ \
example/ \
- GudhUI/
+ GudhUI/ \
+ cmake/ \
+ debian/
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -1801,18 +1803,6 @@ GENERATE_XML = NO
XML_OUTPUT = xml
-# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_DTD =
-
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
# listings (including syntax highlighting and cross-referencing information) to
# the XML output. Note that enabling this will significantly increase the size
diff --git a/src/GudhUI/model/Complex_typedefs.h b/src/GudhUI/model/Complex_typedefs.h
index c310d4a6..a4df2c94 100644
--- a/src/GudhUI/model/Complex_typedefs.h
+++ b/src/GudhUI/model/Complex_typedefs.h
@@ -41,7 +41,7 @@ struct Geometry_trait : public CGAL::Cartesian_d<double> {
typedef Geometry_trait::Point Point;
using namespace Gudhi;
-using namespace Gudhi::skbl;
+using namespace Gudhi::skeleton_blocker;
typedef Skeleton_blocker_simple_geometric_traits<Geometry_trait> Complex_geometric_traits;
typedef Skeleton_blocker_geometric_complex< Complex_geometric_traits > Complex;
diff --git a/src/GudhUI/model/Model.h b/src/GudhUI/model/Model.h
index 1c39c0d7..77e37b6c 100644
--- a/src/GudhUI/model/Model.h
+++ b/src/GudhUI/model/Model.h
@@ -72,8 +72,8 @@ class CGAL_geometric_flag_complex_wrapper {
void maximal_face(std::vector<int> vertices) {
if (!load_only_points_) {
// std::cout << "size:" << vertices.size() << std::endl;
- for (int i = 0; i < vertices.size(); ++i)
- for (int j = i + 1; j < vertices.size(); ++j)
+ for (std::size_t i = 0; i < vertices.size(); ++i)
+ for (std::size_t j = i + 1; j < vertices.size(); ++j)
complex_.add_edge(Vertex_handle(vertices[i]), Vertex_handle(vertices[j]));
}
}
diff --git a/src/GudhUI/utils/Edge_contractor.h b/src/GudhUI/utils/Edge_contractor.h
index 45079a40..8a29ff4b 100644
--- a/src/GudhUI/utils/Edge_contractor.h
+++ b/src/GudhUI/utils/Edge_contractor.h
@@ -65,7 +65,7 @@ template<typename SkBlComplex> class Edge_contractor {
Placement_type operator()(const EdgeProfile& profile) const override {
std::vector<double> mid_coords(profile.p0().dimension(), 0);
- for (size_t i = 0; i < profile.p0().dimension(); ++i) {
+ for (int i = 0; i < profile.p0().dimension(); ++i) {
mid_coords[i] = (profile.p0()[i] + profile.p1()[i]) / 2.;
}
return Point(profile.p0().dimension(), mid_coords.begin(), mid_coords.end());
diff --git a/src/GudhUI/utils/Furthest_point_epsilon_net.h b/src/GudhUI/utils/Furthest_point_epsilon_net.h
index f2a216f6..98346daa 100644
--- a/src/GudhUI/utils/Furthest_point_epsilon_net.h
+++ b/src/GudhUI/utils/Furthest_point_epsilon_net.h
@@ -73,7 +73,7 @@ template<typename SkBlComplex> class Furthest_point_epsilon_net {
complex_(complex) {
if (!complex.empty()) {
init_filtration();
- for (int k = 2; k < net_filtration_.size(); ++k) {
+ for (std::size_t k = 2; k < net_filtration_.size(); ++k) {
update_radius_value(k);
}
}
diff --git a/src/GudhUI/view/FirstCoordProjector.h b/src/GudhUI/view/FirstCoordProjector.h
index a4027b7f..1333f5d3 100644
--- a/src/GudhUI/view/FirstCoordProjector.h
+++ b/src/GudhUI/view/FirstCoordProjector.h
@@ -33,9 +33,11 @@ class FirstCoordProjector3D : public Projector3D {
Point_3 operator()(const Point& p) const {
if (p.dimension() >= 3)
- return Point_3(p.x(), p.y(), p.z());
+ return Point_3(p.x(), p.y(), p.z());
else if (p.dimension() >= 2)
- return Point_3(p.x(), p.y(), 0.0);
+ return Point_3(p.x(), p.y(), 0.0);
+ else
+ return Point_3(0.0, 0.0, 0.0);
}
};
diff --git a/src/Persistent_cohomology/doc/Intro_persistent_cohomology.h b/src/Persistent_cohomology/doc/Intro_persistent_cohomology.h
index c8081cac..433cfd3e 100644
--- a/src/Persistent_cohomology/doc/Intro_persistent_cohomology.h
+++ b/src/Persistent_cohomology/doc/Intro_persistent_cohomology.h
@@ -46,7 +46,7 @@ namespace persistent_cohomology {
composed of three elements:
topological spaces, their homology groups and an evolution scheme.
- <DT>Topological Spaces:</DT>
+ \section persistencetopolocalspaces Topological Spaces
Topological spaces are represented by simplicial complexes.
Let \f$V = \{1, \cdots ,|V|\}\f$ be a set of <EM>vertices</EM>.
A <EM>simplex</EM> \f$\sigma\f$ is a subset of vertices
@@ -84,7 +84,7 @@ namespace persistent_cohomology {
<CODE>Filtration_value filtration (Simplex_handle)</CODE> that returns the value of
the filtration on the simplex represented by the handle.
- <DT>Homology:</DT>
+ \section persistencehomology Homology
For a ring \f$\mathcal{R}\f$, the group of <EM>n-chains</EM>,
denoted \f$\mathbf{C}_n(\mathbf{K},\mathcal{R})\f$, of \f$\mathbf{K}\f$ is the
group of formal sums of
@@ -111,7 +111,7 @@ namespace persistent_cohomology {
We refer to \cite Munkres-elementsalgtop1984 for an introduction to homology
theory and to \cite DBLP:books/daglib/0025666 for an introduction to persistent homology.
- <DT>Indexing Scheme:</DT>
+ \section persistenceindexingscheme Indexing Scheme
"Changing" a simplicial complex consists in applying a simplicial map.
An <EM>indexing scheme</EM> is a directed graph together with a traversal
order, such that two
@@ -139,19 +139,63 @@ namespace persistent_cohomology {
by increasing filtration values (breaking ties so as a simplex appears after
its subsimplices of same filtration value) provides an indexing scheme.
-\section Examples
- We provide several example files: run these examples with -h for details on their use, and read the README file.
+\section pcohexamples Examples
-\li <CODE>rips_persistence.cpp</CODE> computes the Rips complex of a point cloud and its persistence diagram.
+We provide several example files: run these examples with -h for details on their use, and read the README file.
-\li <CODE>rips_multifield_persistence.cpp</CODE> computes the Rips complex of a point cloud and its persistence diagram
-with a family of field coefficients.
+\li <a href="_persistent_cohomology_2rips_persistence_8cpp-example.html">
+Persistent_cohomology/rips_persistence.cpp</a> computes the Rips complex of a point cloud and its persistence diagram.
-\li <CODE>performance_rips_persistence.cpp</CODE> provides timings for the construction of the Rips complex on a set of
-points sampling a Klein bottle in \f$\mathbb{R}^5\f$ with a simplex tree, its conversion to a
+\li <a href="_persistent_cohomology_2rips_multifield_persistence_8cpp-example.html">
+Persistent_cohomology/rips_multifield_persistence.cpp</a> computes the Rips complex of a point cloud and its
+persistence diagram with a family of field coefficients.
+
+\li <a href="_persistent_cohomology_2performance_rips_persistence_8cpp-example.html">
+Persistent_cohomology/performance_rips_persistence.cpp</a> provides timings for the construction of the Rips complex
+on a set of points sampling a Klein bottle in \f$\mathbb{R}^5\f$ with a simplex tree, its conversion to a
Hasse diagram and the computation of persistent homology and multi-field persistent homology for the
different representations.
+\li <a href="_persistent_cohomology_2alpha_complex_3d_persistence_8cpp-example.html">
+Persistent_cohomology/alpha_complex_3d_persistence.cpp</a> computes the persistent homology with
+\f$\mathbb{Z}/2\mathbb{Z}\f$ coefficients of the alpha complex on points sampling from an OFF file.
+\code $> ./alpha_complex_3d_persistence ../../data/points/tore3D_300.off 2 0.45 \endcode
+\code Simplex_tree dim: 3
+2 0 0 inf
+2 1 0.0682162 1.0001
+2 1 0.0934117 1.00003
+2 2 0.56444 1.03938 \endcode
+
+\li <a href="_persistent_cohomology_2alpha_complex_persistence_8cpp-example.html">
+Persistent_cohomology/alpha_complex_persistence.cpp</a> computes the persistent homology with
+\f$\mathbb{Z}/p\mathbb{Z}\f$ coefficients of the alpha complex on points sampling from an OFF file.
+\code $> ./alpha_complex_persistence -r 32 -p 2 -m 0.45 ../../data/points/tore3D_300.off \endcode
+\code Alpha complex is of dimension 3 - 9273 simplices - 300 vertices.
+Simplex_tree dim: 3
+2 0 0 inf
+2 1 0.0682162 1.0001
+2 1 0.0934117 1.00003
+2 2 0.56444 1.03938 \endcode
+
+\li <a href="_persistent_cohomology_2periodic_alpha_complex_3d_persistence_8cpp-example.html">
+Persistent_cohomology/periodic_alpha_complex_3d_persistence.cpp</a> computes the persistent homology with
+\f$\mathbb{Z}/2\mathbb{Z}\f$ coefficients of the periodic alpha complex on points sampling from an OFF file.
+\code $> ./periodic_alpha_complex_3d_persistence ../../data/points/grid_10_10_10_in_0_1.off 3 1.0 \endcode
+\code Periodic Delaunay computed.
+Simplex_tree dim: 3
+3 0 0 inf
+3 1 0.0025 inf
+3 1 0.0025 inf
+3 1 0.0025 inf
+3 2 0.005 inf
+3 2 0.005 inf
+3 2 0.005 inf
+3 3 0.0075 inf \endcode
+
+\li <a href="_persistent_cohomology_2plain_homology_8cpp-example.html">
+Persistent_cohomology/plain_homology.cpp</a> computes the plain homology of a simple simplicial complex without
+filtration values.
+
\copyright GNU General Public License v3.
*/
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt
index b823d658..d97d1b63 100644
--- a/src/Persistent_cohomology/example/CMakeLists.txt
+++ b/src/Persistent_cohomology/example/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIExPersCohom)
+project(Persistent_cohomology_examples)
# problem with Visual Studio link on Boost program_options
add_definitions( -DBOOST_ALL_NO_LIB )
@@ -36,11 +36,7 @@ add_test(persistence_from_file_3_2_0 ${CMAKE_CURRENT_BINARY_DIR}/persistence_fro
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(GMP_FOUND)
- message("GMP_LIBRARIES = ${GMP_LIBRARIES}")
-
if(GMPXX_FOUND)
- message("GMPXX_LIBRARIES = ${GMPXX_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_executable ( performance_rips_persistence performance_rips_persistence.cpp )
@@ -52,53 +48,37 @@ if(GMP_FOUND)
add_test(rips_multifield_persistence_2_71 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.2 -d 3 -p 2 -q 71 -m 100)
endif(GMPXX_FOUND)
-else()
- # message(WARNING "GMP not found.")
endif(GMP_FOUND)
- if(CGAL_FOUND)
- add_executable(alpha_complex_3d_persistence alpha_complex_3d_persistence.cpp)
- target_link_libraries(alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
-
- if (TBB_FOUND)
- target_link_libraries(alpha_complex_3d_persistence ${TBB_LIBRARIES})
- endif(TBB_FOUND)
- add_test(alpha_complex_3d_persistence_2_0_5 ${CMAKE_CURRENT_BINARY_DIR}/alpha_complex_3d_persistence ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off 2 0.45)
-
-
- if (NOT CGAL_VERSION VERSION_LESS 4.7.0)
- message(STATUS "CGAL version: ${CGAL_VERSION}.")
-
- find_package(Eigen3 3.1.0)
- if (EIGEN3_FOUND)
- message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
- include( ${EIGEN3_USE_FILE} )
-
- add_executable (alpha_complex_persistence alpha_complex_persistence.cpp)
- target_link_libraries(alpha_complex_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
-
- add_executable(periodic_alpha_complex_3d_persistence periodic_alpha_complex_3d_persistence.cpp)
- target_link_libraries(periodic_alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
-
- add_executable(custom_persistence_sort custom_persistence_sort.cpp)
- target_link_libraries(custom_persistence_sort ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
-
- if (TBB_FOUND)
- target_link_libraries(alpha_complex_persistence ${TBB_LIBRARIES})
- target_link_libraries(periodic_alpha_complex_3d_persistence ${TBB_LIBRARIES})
- target_link_libraries(custom_persistence_sort ${TBB_LIBRARIES})
- endif(TBB_FOUND)
- add_test(alpha_complex_persistence_2_0_45 ${CMAKE_CURRENT_BINARY_DIR}/alpha_complex_persistence ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -m 0.45 -p 2)
- add_test(periodic_alpha_complex_3d_persistence_2_0 ${CMAKE_CURRENT_BINARY_DIR}/periodic_alpha_complex_3d_persistence ${CMAKE_SOURCE_DIR}/data/points/grid_10_10_10_in_0_1.off ${CMAKE_SOURCE_DIR}/data/points/iso_cuboid_3_in_0_1.txt 2 0)
- add_test(custom_persistence_sort ${CMAKE_CURRENT_BINARY_DIR}/custom_persistence_sort)
-
- else()
- message(WARNING "Eigen3 not found. Version 3.1.0 is required for Alpha shapes feature.")
- endif(EIGEN3_FOUND)
- else()
- message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Alpha shapes feature. Version 4.6.0 is required.")
- endif ()
- else()
- # message(WARNING "CGAL not found.")
- endif(CGAL_FOUND)
-
+if(CGAL_FOUND)
+ add_executable(alpha_complex_3d_persistence alpha_complex_3d_persistence.cpp)
+ target_link_libraries(alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+
+ if (TBB_FOUND)
+ target_link_libraries(alpha_complex_3d_persistence ${TBB_LIBRARIES})
+ endif(TBB_FOUND)
+ add_test(alpha_complex_3d_persistence_2_0_5 ${CMAKE_CURRENT_BINARY_DIR}/alpha_complex_3d_persistence ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off 2 0.45)
+
+
+ if (NOT CGAL_VERSION VERSION_LESS 4.7.0)
+ if (EIGEN3_FOUND)
+ add_executable (alpha_complex_persistence alpha_complex_persistence.cpp)
+ target_link_libraries(alpha_complex_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+
+ add_executable(periodic_alpha_complex_3d_persistence periodic_alpha_complex_3d_persistence.cpp)
+ target_link_libraries(periodic_alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+
+ add_executable(custom_persistence_sort custom_persistence_sort.cpp)
+ target_link_libraries(custom_persistence_sort ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+
+ if (TBB_FOUND)
+ target_link_libraries(alpha_complex_persistence ${TBB_LIBRARIES})
+ target_link_libraries(periodic_alpha_complex_3d_persistence ${TBB_LIBRARIES})
+ target_link_libraries(custom_persistence_sort ${TBB_LIBRARIES})
+ endif(TBB_FOUND)
+ add_test(alpha_complex_persistence_2_0_45 ${CMAKE_CURRENT_BINARY_DIR}/alpha_complex_persistence ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -m 0.45 -p 2)
+ add_test(periodic_alpha_complex_3d_persistence_2_0 ${CMAKE_CURRENT_BINARY_DIR}/periodic_alpha_complex_3d_persistence ${CMAKE_SOURCE_DIR}/data/points/grid_10_10_10_in_0_1.off ${CMAKE_SOURCE_DIR}/data/points/iso_cuboid_3_in_0_1.txt 2 0)
+ add_test(custom_persistence_sort ${CMAKE_CURRENT_BINARY_DIR}/custom_persistence_sort)
+ endif(EIGEN3_FOUND)
+ endif (NOT CGAL_VERSION VERSION_LESS 4.7.0)
+endif(CGAL_FOUND)
diff --git a/src/Persistent_cohomology/example/alpha_complex_persistence.cpp b/src/Persistent_cohomology/example/alpha_complex_persistence.cpp
index 17fb84d2..cb181936 100644
--- a/src/Persistent_cohomology/example/alpha_complex_persistence.cpp
+++ b/src/Persistent_cohomology/example/alpha_complex_persistence.cpp
@@ -30,7 +30,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::alphacomplex::Alpha_complex<Kernel> alpha_complex_from_file(off_file_points, alpha_square_max_value);
+ Gudhi::alpha_complex::Alpha_complex<Kernel> alpha_complex_from_file(off_file_points, alpha_square_max_value);
// ----------------------------------------------------------------------------
// Display information about the alpha complex
@@ -44,7 +44,7 @@ int main(int argc, char **argv) {
std::cout << "Simplex_tree dim: " << alpha_complex_from_file.dimension() << std::endl;
// Compute the persistence diagram of the complex
- Gudhi::persistent_cohomology::Persistent_cohomology< Gudhi::alphacomplex::Alpha_complex<Kernel>,
+ Gudhi::persistent_cohomology::Persistent_cohomology< Gudhi::alpha_complex::Alpha_complex<Kernel>,
Gudhi::persistent_cohomology::Field_Zp > pcoh(alpha_complex_from_file);
// initializes the coefficient field for homology
pcoh.init_coefficients(coeff_field_characteristic);
diff --git a/src/Persistent_cohomology/example/custom_persistence_sort.cpp b/src/Persistent_cohomology/example/custom_persistence_sort.cpp
index d591a0d0..9af38611 100644
--- a/src/Persistent_cohomology/example/custom_persistence_sort.cpp
+++ b/src/Persistent_cohomology/example/custom_persistence_sort.cpp
@@ -37,7 +37,7 @@
using Kernel = CGAL::Epick_d< CGAL::Dimension_tag<3> >;
using Point = Kernel::Point_d;
-using Alpha_complex = Gudhi::alphacomplex::Alpha_complex<Kernel>;
+using Alpha_complex = Gudhi::alpha_complex::Alpha_complex<Kernel>;
std::vector<Point> random_points() {
// Instanciate a random point generator
diff --git a/src/Persistent_cohomology/example/plain_homology.cpp b/src/Persistent_cohomology/example/plain_homology.cpp
index 2156ffd9..ae82c817 100644
--- a/src/Persistent_cohomology/example/plain_homology.cpp
+++ b/src/Persistent_cohomology/example/plain_homology.cpp
@@ -25,6 +25,7 @@
#include <iostream>
#include <vector>
+#include <cstdint> // for std::uint8_t
using namespace Gudhi;
@@ -39,6 +40,8 @@ struct MyOptions : Simplex_tree_options_full_featured {
static const bool store_key = true;
// I have few vertices
typedef short Vertex_handle;
+ // Maximum number of simplices to compute persistence is 2^8 - 1 = 255. One is reserved for null_key
+ typedef std::uint8_t Simplex_key;
};
typedef Simplex_tree<MyOptions> ST;
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
index a7d1e463..b31df6a4 100644
--- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
+++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
@@ -41,6 +41,7 @@
#include <tuple>
#include <algorithm>
#include <string>
+#include <stdexcept> // for std::out_of_range
namespace Gudhi {
@@ -89,6 +90,7 @@ class Persistent_cohomology {
*
* @param[in] cpx Complex for which the persistent homology is computed.
* cpx is a model of FilteredComplex
+ * @exception std::out_of_range In case the number of simplices is more than Simplex_key type numeric limit.
*/
explicit Persistent_cohomology(Complex_ds& cpx)
: cpx_(&cpx),
@@ -106,6 +108,10 @@ class Persistent_cohomology {
interval_length_policy(&cpx, 0),
column_pool_(), // memory pools for the CAM
cell_pool_() {
+ if (cpx_->num_simplices() > std::numeric_limits<Simplex_key>::max()) {
+ // num_simplices must be strictly lower than the limit, because a value is reserved for null_key.
+ throw std::out_of_range ("The number of simplices is more than Simplex_key type numeric limit.");
+ }
Simplex_key idx_fil = 0;
for (auto sh : cpx_->filtration_simplex_range()) {
cpx_->assign_key(sh, idx_fil);
diff --git a/src/Persistent_cohomology/test/CMakeLists.txt b/src/Persistent_cohomology/test/CMakeLists.txt
index 18d85eda..a21f39c4 100644
--- a/src/Persistent_cohomology/test/CMakeLists.txt
+++ b/src/Persistent_cohomology/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIPersistentCohomologyUT)
+project(Persistent_cohomology_tests)
if (GCOVR_PATH)
# for gcovr to make coverage reports - Corbera Jenkins plugin
diff --git a/src/Persistent_cohomology/test/betti_numbers_unit_test.cpp b/src/Persistent_cohomology/test/betti_numbers_unit_test.cpp
index a4e00b45..40221005 100644
--- a/src/Persistent_cohomology/test/betti_numbers_unit_test.cpp
+++ b/src/Persistent_cohomology/test/betti_numbers_unit_test.cpp
@@ -12,7 +12,7 @@
#include "gudhi/Simplex_tree.h"
#include "gudhi/Persistent_cohomology.h"
-struct MyOptions : Gudhi::Simplex_tree_options_full_featured {
+struct MiniSTOptions : Gudhi::Simplex_tree_options_full_featured {
// Implicitly use 0 as filtration value for all simplices
static const bool store_filtration = false;
// The persistence algorithm needs this
@@ -21,7 +21,7 @@ struct MyOptions : Gudhi::Simplex_tree_options_full_featured {
typedef short Vertex_handle;
};
-using Mini_simplex_tree = Gudhi::Simplex_tree<MyOptions>;
+using Mini_simplex_tree = Gudhi::Simplex_tree<MiniSTOptions>;
using Mini_st_persistence =
Gudhi::persistent_cohomology::Persistent_cohomology<Mini_simplex_tree, Gudhi::persistent_cohomology::Field_Zp>;
diff --git a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp
index 194b3e74..6efd749e 100644
--- a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp
+++ b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp
@@ -4,6 +4,7 @@
#include <utility> // std::pair, std::make_pair
#include <cmath> // float comparison
#include <limits>
+#include <cstdint> // for std::uint8_t
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE "persistent_cohomology"
@@ -43,7 +44,7 @@ std::string test_rips_persistence(int coefficient, int min_persistence) {
st.initialize_filtration();
// Compute the persistence diagram of the complex
- persistent_cohomology::Persistent_cohomology<Simplex_tree<>, Field_Zp> pcoh(st);
+ Persistent_cohomology<Simplex_tree<>, Field_Zp> pcoh(st);
pcoh.init_coefficients( coefficient ); // initializes the coefficient field for homology
// Check infinite rips
@@ -172,3 +173,45 @@ BOOST_AUTO_TEST_CASE( rips_persistent_cohomology_single_field_dim_5 )
// std::string str_rips_persistence = test_rips_persistence(6, 0);
// TODO(VR): division by zero
// std::string str_rips_persistence = test_rips_persistence(0, 0);
+
+/** SimplexTree minimal options to test the limits.
+ *
+ * Maximum number of simplices to compute persistence is <CODE>std::numeric_limits<std::uint8_t>::max()<\CODE> = 256.*/
+struct MiniSTOptions {
+ typedef linear_indexing_tag Indexing_tag;
+ typedef short Vertex_handle;
+ typedef double Filtration_value;
+ // Maximum number of simplices to compute persistence is 2^8 - 1 = 255. One is reserved for null_key
+ typedef std::uint8_t Simplex_key;
+ static const bool store_key = true;
+ static const bool store_filtration = false;
+ static const bool contiguous_vertices = false;
+};
+
+using Mini_simplex_tree = Gudhi::Simplex_tree<MiniSTOptions>;
+using Mini_st_persistence =
+ Gudhi::persistent_cohomology::Persistent_cohomology<Mini_simplex_tree, Gudhi::persistent_cohomology::Field_Zp>;
+
+BOOST_AUTO_TEST_CASE( persistence_constructor_exception )
+{
+ Mini_simplex_tree st;
+
+ // To make number of simplices = 255
+ const short simplex_0[] = {0, 1, 2, 3, 4, 5, 6, 7};
+ st.insert_simplex_and_subfaces(simplex_0);
+ // FIXME: Remove this line
+ st.set_dimension(8);
+
+ // Sort the simplices in the order of the filtration
+ st.initialize_filtration();
+
+ BOOST_CHECK(st.num_simplices() <= std::numeric_limits<MiniSTOptions::Simplex_key>::max());
+ // Class for homology computation
+ BOOST_CHECK_NO_THROW(Mini_st_persistence pcoh(st));
+
+ st.insert_simplex({8});
+ BOOST_CHECK(st.num_simplices() > std::numeric_limits<MiniSTOptions::Simplex_key>::max());
+ // Class for homology computation
+ BOOST_CHECK_THROW(Mini_st_persistence pcoh2(st), std::out_of_range);
+
+}
diff --git a/src/Simplex_tree/concept/SimplexKey.h b/src/Simplex_tree/concept/SimplexKey.h
index 7fdbdd84..9fbed401 100644
--- a/src/Simplex_tree/concept/SimplexKey.h
+++ b/src/Simplex_tree/concept/SimplexKey.h
@@ -22,7 +22,7 @@
/** \brief Key type used as simplex identifier.
*
- * Must be a signed integer type.
+ * Must be an integer type.
*/
struct SimplexKey {};
diff --git a/src/Simplex_tree/concept/SimplexTreeOptions.h b/src/Simplex_tree/concept/SimplexTreeOptions.h
index d072cf34..89acdc18 100644
--- a/src/Simplex_tree/concept/SimplexTreeOptions.h
+++ b/src/Simplex_tree/concept/SimplexTreeOptions.h
@@ -31,7 +31,7 @@ struct SimplexTreeOptions {
typedef VertexHandle Vertex_handle;
/// Must be comparable with operator<.
typedef FiltrationValue Filtration_value;
- /// Must be a signed integer type.
+ /// Must be an integer type.
typedef SimplexKey Simplex_key;
/// If true, each simplex has extra storage for one `Simplex_key`. Necessary for `Persistent_cohomology`.
static const bool store_key;
diff --git a/src/Simplex_tree/doc/Intro_simplex_tree.h b/src/Simplex_tree/doc/Intro_simplex_tree.h
new file mode 100644
index 00000000..be061785
--- /dev/null
+++ b/src/Simplex_tree/doc/Intro_simplex_tree.h
@@ -0,0 +1,85 @@
+/* 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): Clément Maria
+ *
+ * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DOC_SIMPLEX_TREE_INTRO_SIMPLEX_TREE_H_
+#define DOC_SIMPLEX_TREE_INTRO_SIMPLEX_TREE_H_
+
+// needs namespace for Doxygen to link on classes
+namespace Gudhi {
+
+
+/** \defgroup simplex_tree Filtered Complexes
+ * @{
+ * \author Cl&eacute;ment Maria
+ *
+ * A simplicial complex \f$\mathbf{K}\f$ on a set of vertices \f$V = \{1, \cdots ,|V|\}\f$ is a collection of
+ * implices \f$\{\sigma\}\f$, \f$\sigma \subseteq V\f$ such that
+ * \f$\tau \subseteq \sigma \in \mathbf{K} \rightarrow \tau \in \mathbf{K}\f$. The dimension \f$n=|\sigma|-1\f$ of
+ * \f$\sigma\f$ is its number of elements minus \f$1\f$.
+ *
+ * A filtration of a simplicial complex is a function \f$f:\mathbf{K} \rightarrow \mathbb{R}\f$ satisfying
+ * \f$f(\tau)\leq f(\sigma)\f$ whenever \f$\tau \subseteq \sigma\f$. Ordering the simplices by increasing filtration
+ * values (breaking ties so as a simplex appears after its subsimplices of same filtration value) provides an
+ * indexing scheme.
+ *
+ * \section filteredcomplexesimplementation Implementations
+ * \subsection filteredcomplexessimplextree Simplex tree
+ * There are two implementation of complexes. The first on is the Simplex_tree data structure. The simplex tree is an
+ * efficient and flexible data structure for representing general (filtered) simplicial complexes. The data structure
+ * is described in \cite boissonnatmariasimplextreealgorithmica
+ * \image html "Simplex_tree_representation.png" "Simplex tree representation"
+ *
+ * \subsubsection filteredcomplexessimplextreeexamples Examples
+ *
+ * Here is a list of simplex tree examples :
+ * \li <a href="_simplex_tree_2simple_simplex_tree_8cpp-example.html">
+ * Simplex_tree/simple_simplex_tree.cpp</a> - Simple simplex tree construction and basic function use.
+ *
+ * \li <a href="_simplex_tree_2simplex_tree_from_cliques_of_graph_8cpp-example.html">
+ * Simplex_tree/simplex_tree_from_cliques_of_graph.cpp</a> - Simplex tree construction from cliques of graph read in
+ * a file.
+ *
+ * Simplex tree construction with \f$\mathbb{Z}/3\mathbb{Z}\f$ coefficients on weighted graph Klein bottle file:
+ * \code $> ./simplex_tree_from_cliques_of_graph ../../data/points/Klein_bottle_complex.txt 3 \endcode
+ * \code Insert the 1-skeleton in the simplex tree in 0.000404 s.
+max_dim = 3
+Expand the simplex tree in 3.8e-05 s.
+Information of the Simplex Tree:
+Number of vertices = 10 Number of simplices = 98 \endcode
+ *
+ * \li <a href="_simplex_tree_2simplex_tree_from_alpha_shapes_3_8cpp-example.html">
+ * Simplex_tree/simplex_tree_from_alpha_shapes_3.cpp</a> - Simplex tree is computed and displayed from a 3D alpha
+ * complex (Requires CGAL, GMP and GMPXX to be installed)
+ *
+ *
+ * \subsection filteredcomplexeshassecomplex Hasse complex
+ * The second one is the Hasse_complex. The Hasse complex is a data structure representing explicitly all co-dimension
+ * 1 incidence relations in a complex. It is consequently faster when accessing the boundary of a simplex, but is less
+ * compact and harder to construct from scratch.
+ *
+ * \copyright GNU General Public License v3.
+ * @}
+ */
+
+} // namespace Gudhi
+
+#endif // DOC_SIMPLEX_TREE_INTRO_SIMPLEX_TREE_H_
diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt
index 30a34b20..9314a805 100644
--- a/src/Simplex_tree/example/CMakeLists.txt
+++ b/src/Simplex_tree/example/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHISimplexTreeFromFile)
+project(Simplex_tree_examples)
add_executable ( simplex_tree_from_cliques_of_graph simplex_tree_from_cliques_of_graph.cpp )
if (TBB_FOUND)
diff --git a/src/Simplex_tree/example/README b/src/Simplex_tree/example/README
index 03c759cb..e37af790 100644
--- a/src/Simplex_tree/example/README
+++ b/src/Simplex_tree/example/README
@@ -52,7 +52,7 @@ EXAMPLE OF SIMPLE INSERTION
*** Simplex tree construction with Z/2Z coefficients on weighted graph Klein bottle file:
-./simplex_tree_from_file ../../../data/points/Klein_bottle_complex.txt 2
+./simplex_tree_from_cliques_of_graph ../../../data/points/Klein_bottle_complex.txt 2
Insert the 1-skeleton in the simplex tree in 0 s.
Expand the simplex tree in 0 s.
Information of the Simplex Tree:
@@ -60,7 +60,7 @@ Information of the Simplex Tree:
with Z/3Z coefficients:
-./simplex_tree_from_file ../../../data/points/Klein_bottle_complex.txt 3
+./simplex_tree_from_cliques_of_graph ../../../data/points/Klein_bottle_complex.txt 3
Insert the 1-skeleton in the simplex tree in 0 s.
Expand the simplex tree in 0 s.
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h
index 65ead001..63e3f0e5 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h
@@ -48,40 +48,9 @@
#include <limits> // Inf
#include <initializer_list>
#include <algorithm> // for std::max
+#include <cstdint> // for std::uint32_t
namespace Gudhi {
-/** \defgroup simplex_tree Filtered Complexes
- * \author Cl&eacute;ment Maria
- *
- * A simplicial complex \f$\mathbf{K}\f$
- * on a set of vertices \f$V = \{1, \cdots ,|V|\}\f$ is a collection of simplices
- * \f$\{\sigma\}\f$,
- * \f$\sigma \subseteq V\f$ such that \f$\tau \subseteq \sigma \in \mathbf{K} \rightarrow \tau \in
- * \mathbf{K}\f$. The
- * dimension \f$n=|\sigma|-1\f$ of \f$\sigma\f$ is its number of elements minus \f$1\f$.
- *
- * A filtration of a simplicial complex is
- * a function \f$f:\mathbf{K} \rightarrow \mathbb{R}\f$ satisfying \f$f(\tau)\leq f(\sigma)\f$ whenever
- * \f$\tau \subseteq \sigma\f$. Ordering the simplices by increasing filtration values
- * (breaking ties so as a simplex appears after its subsimplices of same filtration value)
- * provides an indexing scheme.
- *
-
- <DT>Implementations:</DT>
- There are two implementation of complexes. The first on is the Simplex_tree data structure.
- The simplex tree is an efficient and flexible
- data structure for representing general (filtered) simplicial complexes. The data structure
- is described in \cite boissonnatmariasimplextreealgorithmica
- \image html "Simplex_tree_representation.png" "Simplex tree representation"
-
- The second one is the Hasse_complex. The Hasse complex is a data structure representing
- explicitly all co-dimension 1 incidence relations in a complex. It is consequently faster
- when accessing the boundary of a simplex, but is less compact and harder to construct from
- scratch.
-
- * \copyright GNU General Public License v3.
- * @{
- */
struct Simplex_tree_options_full_featured;
@@ -109,7 +78,7 @@ class Simplex_tree {
typedef typename Options::Filtration_value Filtration_value;
/** \brief Key associated to each simplex.
*
- * Must be a signed integer type. */
+ * Must be an integer type. */
typedef typename Options::Simplex_key Simplex_key;
/** \brief Type for the vertex handle.
*
@@ -1297,25 +1266,31 @@ std::istream& operator>>(std::istream & is, Simplex_tree<T...> & st) {
return is;
}
-/// Model of SimplexTreeOptions.
+/** Model of SimplexTreeOptions.
+ *
+ * Maximum number of simplices to compute persistence is <CODE>std::numeric_limits<std::uint32_t>::max()</CODE>
+ * (about 4 billions of simplices). */
struct Simplex_tree_options_full_featured {
typedef linear_indexing_tag Indexing_tag;
typedef int Vertex_handle;
typedef double Filtration_value;
- typedef int Simplex_key;
+ typedef std::uint32_t Simplex_key;
static const bool store_key = true;
static const bool store_filtration = true;
static const bool contiguous_vertices = false;
};
-/** Model of SimplexTreeOptions, faster than
- `Simplex_tree_options_full_featured` but note the unsafe
- `contiguous_vertices` option. */
+/** Model of SimplexTreeOptions, faster than `Simplex_tree_options_full_featured` but note the unsafe
+ * `contiguous_vertices` option.
+ *
+ * Maximum number of simplices to compute persistence is <CODE>std::numeric_limits<std::uint32_t>::max()</CODE>
+ * (about 4 billions of simplices). */
+
struct Simplex_tree_options_fast_persistence {
typedef linear_indexing_tag Indexing_tag;
typedef int Vertex_handle;
typedef float Filtration_value;
- typedef int Simplex_key;
+ typedef std::uint32_t Simplex_key;
static const bool store_key = true;
static const bool store_filtration = true;
static const bool contiguous_vertices = true;
diff --git a/src/Simplex_tree/test/CMakeLists.txt b/src/Simplex_tree/test/CMakeLists.txt
index d6755c49..e95d0782 100644
--- a/src/Simplex_tree/test/CMakeLists.txt
+++ b/src/Simplex_tree/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHISimplexTreeUT)
+project(Simplex_tree_tests)
if (GCOVR_PATH)
# for gcovr to make coverage reports - Corbera Jenkins plugin
diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
index b1bb23b1..28bf202b 100644
--- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
@@ -806,14 +806,14 @@ BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing) {
st.insert_simplex_and_subfaces({3, 0}, 2.0);
st.insert_simplex_and_subfaces({3, 4, 5}, 2.0);
- // Inserted simplex:
- // 1
- // o
- // /X\
- // o---o---o---o
- // 2 0 3\X/4
- // o
- // 5
+ /* Inserted simplex: */
+ /* 1 */
+ /* o */
+ /* /X\ */
+ /* o---o---o---o */
+ /* 2 0 3\X/4 */
+ /* o */
+ /* 5 */
std::cout << "Check default insertion ensures the filtration values are non decreasing" << std::endl;
BOOST_CHECK(!st.make_filtration_non_decreasing());
diff --git a/src/Skeleton_blocker/concept/SkeletonBlockerDS.h b/src/Skeleton_blocker/concept/SkeletonBlockerDS.h
index c0386590..d82425a0 100644
--- a/src/Skeleton_blocker/concept/SkeletonBlockerDS.h
+++ b/src/Skeleton_blocker/concept/SkeletonBlockerDS.h
@@ -1,20 +1,31 @@
-/*
- * SkeletonBlockerDS.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.
*
- * Created on: Feb 20, 2014
- * Author: David Salinas
- * Copyright 2013 INRIA. All rights reserved
+ * Author(s): David Salinas
+ *
+ * Copyright (C) 2014 INRIA
+ *
+ * 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 <http://www.gnu.org/licenses/>.
*/
-#ifndef GUDHI_SKELETONBLOCKERDS_H_
-#define GUDHI_SKELETONBLOCKERDS_H_
-
+#ifndef CONCEPT_SKELETON_BLOCKER_SKELETONBLOCKERDS_H_
+#define CONCEPT_SKELETON_BLOCKER_SKELETONBLOCKERDS_H_
namespace Gudhi {
-namespace skbl {
-
-
+namespace skeleton_blocker {
/** \brief Concept for the template class passed for Skeleton_blocker_complex.
* Most importantly, it contains the nodes for vertices and edges
@@ -22,104 +33,97 @@ namespace skbl {
* complex. The user can redefine these classes to attach
* additional information to vertices and edges.
*/
-struct SkeletonBlockerDS
-{
- /**
- * @brief index that allows to find the vertex in the boost graph
- */
- typedef int boost_vertex_handle;
-
-
- /**
- * @brief Root_vertex_handle and Vertex_handle are similar to global and local vertex descriptor
- * used in <a href="http://www.boost.org/doc/libs/1_38_0/libs/graph/doc/subgraph.html">boost subgraphs</a>
- * and allow to localize a vertex of a subcomplex on its parent root complex.
- *
- * In gross, vertices are stored in a vector
- * and the Root_vertex_handle and Vertex_handle store indices of a vertex in this vector.
- *
- * For the root simplicial complex, the Root_vertex_handle and Vertex_handle of a vertex
- * are the same.
- *
- *
- * For a subcomplex L of a simplicial complex K, the local descriptor, ie the Vertex_handle, of a
- * vertex v (that belongs to L) is its position in the vector of vertices
- * of the subcomplex L whereas its Root_vertex_handle (global descriptor) is the position of v in the vector of the
- * vertices of the root simplicial complex K.
- */
- struct Root_vertex_handle{
-
- boost_vertex_handle vertex;
-
- friend ostream& operator << (ostream& o, const Root_vertex_handle & v);
- };
-
- /**
- * A Vertex_handle must be Default Constructible, Assignable and Equality Comparable.
- */
- struct Vertex_handle{
- boost_vertex_handle vertex;
-
- friend ostream& operator << (ostream& o, const Vertex_handle & v);
- };
-
-
- /**
- * \brief The type of vertices that are stored the boost graph.
- * A Vertex must be Default Constructible and Equality Comparable.
- *
- */
- struct Graph_vertex{
- /** \brief Used to deactivate a vertex for example when contracting an edge.
- * It allows in some cases to remove the vertex at low cost.
- */
- void deactivate();
-
- /** \brief Used to activate a vertex.
- */
- void activate();
-
- /** \brief Tells if the vertex is active.
- */
- bool is_active() const;
-
- void set_id(Root_vertex_handle i);
- Root_vertex_handle get_id() const;
- virtual string to_string() const ;
- friend ostream& operator << (ostream& o, const Graph_vertex & v);
- };
-
-
- /**
- * \brief The type of edges that are stored the boost graph.
- * An Edge must be Default Constructible and Equality Comparable.
- */
- struct Graph_edge{
- /**
- * @brief Allows to modify vertices of the edge.
- */
- void setId(Root_vertex_handle a,Root_vertex_handle b);
-
- /**
- * @brief Returns the first vertex of the edge.
- */
- Root_vertex_handle first() const ;
-
- /**
- * @brief Returns the second vertex of the edge.
- */
- Root_vertex_handle second() const ;
-
- friend ostream& operator << (ostream& o, const Simple_edge & v);
- };
-
-
+struct SkeletonBlockerDS {
+ /**
+ * @brief index that allows to find the vertex in the boost graph
+ */
+ typedef int boost_vertex_handle;
+
+ /**
+ * @brief Root_vertex_handle and Vertex_handle are similar to global and local vertex descriptor
+ * used in <a href="http://www.boost.org/doc/libs/1_38_0/libs/graph/doc/subgraph.html">boost subgraphs</a>
+ * and allow to localize a vertex of a subcomplex on its parent root complex.
+ *
+ * In gross, vertices are stored in a vector
+ * and the Root_vertex_handle and Vertex_handle store indices of a vertex in this vector.
+ *
+ * For the root simplicial complex, the Root_vertex_handle and Vertex_handle of a vertex
+ * are the same.
+ *
+ *
+ * For a subcomplex L of a simplicial complex K, the local descriptor, ie the Vertex_handle, of a
+ * vertex v (that belongs to L) is its position in the vector of vertices
+ * of the subcomplex L whereas its Root_vertex_handle (global descriptor) is the position of v in the vector of the
+ * vertices of the root simplicial complex K.
+ */
+ struct Root_vertex_handle {
+ boost_vertex_handle vertex;
+
+ friend ostream& operator<<(ostream& o, const Root_vertex_handle & v);
+ };
+
+ /**
+ * A Vertex_handle must be Default Constructible, Assignable and Equality Comparable.
+ */
+ struct Vertex_handle {
+ boost_vertex_handle vertex;
+
+ friend ostream& operator<<(ostream& o, const Vertex_handle & v);
+ };
+
+ /**
+ * \brief The type of vertices that are stored the boost graph.
+ * A Vertex must be Default Constructible and Equality Comparable.
+ *
+ */
+ struct Graph_vertex {
+ /** \brief Used to deactivate a vertex for example when contracting an edge.
+ * It allows in some cases to remove the vertex at low cost.
+ */
+ void deactivate();
+
+ /** \brief Used to activate a vertex.
+ */
+ void activate();
+
+ /** \brief Tells if the vertex is active.
+ */
+ bool is_active() const;
+
+ void set_id(Root_vertex_handle i);
+ Root_vertex_handle get_id() const;
+ virtual string to_string() const;
+ friend ostream& operator<<(ostream& o, const Graph_vertex & v);
+ };
+
+ /**
+ * \brief The type of edges that are stored the boost graph.
+ * An Edge must be Default Constructible and Equality Comparable.
+ */
+ struct Graph_edge {
+ /**
+ * @brief Allows to modify vertices of the edge.
+ */
+ void setId(Root_vertex_handle a, Root_vertex_handle b);
+
+ /**
+ * @brief Returns the first vertex of the edge.
+ */
+ Root_vertex_handle first() const;
+
+ /**
+ * @brief Returns the second vertex of the edge.
+ */
+ Root_vertex_handle second() const;
+
+ friend ostream& operator<<(ostream& o, const Simple_edge & v);
+ };
};
+} // namespace skeleton_blocker
+namespace skbl = skeleton_blocker;
-} // namespace skbl
-} // namespace GUDHI
-
+} // namespace Gudhi
-#endif /* GUDHI_SKELETONBLOCKERDS_H_ */
+#endif // CONCEPT_SKELETON_BLOCKER_SKELETONBLOCKERDS_H_
diff --git a/src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h b/src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h
index 8fbf0d12..477464c4 100644
--- a/src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h
+++ b/src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h
@@ -1,16 +1,30 @@
-/*
- * SkeletonBlockerGeometricDS.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.
*
- * Created on: Feb 20, 2014
- * Author: David Salinas
- * Copyright 2013 INRIA. All rights reserved
+ * Author(s): David Salinas
+ *
+ * Copyright (C) 2014 INRIA
+ *
+ * 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 <http://www.gnu.org/licenses/>.
*/
-#ifndef GUDHI_SKELETONBLOCKERGEOMETRICDS_H_
-#define GUDHI_SKELETONBLOCKERGEOMETRICDS_H_
+#ifndef CONCEPT_SKELETON_BLOCKER_SKELETONBLOCKERGEOMETRICDS_H_
+#define CONCEPT_SKELETON_BLOCKER_SKELETONBLOCKERGEOMETRICDS_H_
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
* \brief Concept for template class of Skeleton_blocker_geometric_complex .
@@ -20,55 +34,57 @@ namespace skbl {
* Graph_edge must specify how to access to an index.
*
*/
- //todo the index is just for contraction, to remove
-template<typename GeometryTrait>
-struct SkeletonBlockerGeometricDS : public SkeletonBlockerDS
-{
+// TODO(DS): the index is just for contraction, to remove
- /**
- * Geometry information.
- */
- typedef GeometryTrait GT ;
+template<typename GeometryTrait>
+struct SkeletonBlockerGeometricDS : public SkeletonBlockerDS {
+ /**
+ * Geometry information.
+ */
+ typedef GeometryTrait GT;
- /**
- * Type of point (should be the same as GT::Point).
- */
- typedef typename GeometryTrait::Point Point;
+ /**
+ * Type of point (should be the same as GT::Point).
+ */
+ typedef typename GeometryTrait::Point Point;
- /**
- * @brief Vertex that stores a point.
- */
- class Graph_vertex : public SkeletonBlockerDS::Graph_vertex{
- public:
- /**
- * @brief Access to the point.
- */
- Point& point();
- /**
- * @brief Access to the point.
- */
- const Point& point();
- };
+ /**
+ * @brief Vertex that stores a point.
+ */
+ class Graph_vertex : public SkeletonBlockerDS::Graph_vertex {
+ public:
+ /**
+ * @brief Access to the point.
+ */
+ Point& point();
+ /**
+ * @brief Access to the point.
+ */
+ const Point& point();
+ };
- /**
- * @brief Edge that allows to access to an index.
- * The indices of the edges are used to store heap information
- * in the edge contraction algorithm.
- */
- class Graph_Edge : public SkeletonBlockerDS::Graph_edge{
- public:
- /**
- * @brief Access to the index.
- */
- int& index();
- /**
- * @brief Access to the index.
- */
- int index();
- };
+ /**
+ * @brief Edge that allows to access to an index.
+ * The indices of the edges are used to store heap information
+ * in the edge contraction algorithm.
+ */
+ class Graph_Edge : public SkeletonBlockerDS::Graph_edge {
+ public:
+ /**
+ * @brief Access to the index.
+ */
+ int& index();
+ /**
+ * @brief Access to the index.
+ */
+ int index();
+ };
};
-} // namespace skbl
-} // namespace GUDHI
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
+
+} // namespace Gudhi
-#endif /* GUDHI_SKELETONBLOCKERGEOMETRICDS_H_ */
+#endif // CONCEPT_SKELETON_BLOCKER_SKELETONBLOCKERGEOMETRICDS_H_
diff --git a/src/Skeleton_blocker/example/CMakeLists.txt b/src/Skeleton_blocker/example/CMakeLists.txt
index de0c7bba..cc7f37f3 100644
--- a/src/Skeleton_blocker/example/CMakeLists.txt
+++ b/src/Skeleton_blocker/example/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIskbl)
+project(Skeleton_blocker_examples)
add_executable(SkeletonBlockerFromSimplices Skeleton_blocker_from_simplices.cpp)
add_executable(SkeletonBlockerIteration Skeleton_blocker_iteration.cpp)
diff --git a/src/Skeleton_blocker/example/Skeleton_blocker_from_simplices.cpp b/src/Skeleton_blocker/example/Skeleton_blocker_from_simplices.cpp
index 5935a56d..076c6a53 100644
--- a/src/Skeleton_blocker/example/Skeleton_blocker_from_simplices.cpp
+++ b/src/Skeleton_blocker/example/Skeleton_blocker_from_simplices.cpp
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -29,11 +29,8 @@
#include <sstream>
#include <vector>
-using namespace std;
-using namespace Gudhi;
-using namespace skbl;
-
-typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_simple_traits Traits;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_complex<Traits> Complex;
typedef Complex::Vertex_handle Vertex_handle;
typedef Complex::Simplex Simplex;
@@ -47,7 +44,7 @@ int main(int argc, char *argv[]) {
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()));
+ Complex complex(Gudhi::skeleton_blocker::make_complex_from_top_faces<Complex>(simplices.begin(), simplices.end()));
std::cout << "Simplices:" << std::endl;
diff --git a/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp b/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp
index 41b5ee00..6a1bc480 100644
--- a/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp
+++ b/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -30,12 +30,8 @@
#include <fstream>
#include <sstream>
-
-using namespace std;
-using namespace Gudhi;
-using namespace skbl;
-
-typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_simple_traits Traits;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_complex<Traits> Complex;
typedef Complex::Vertex_handle Vertex_handle;
typedef Complex::Simplex Simplex;
diff --git a/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp b/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp
index 698a8106..58322038 100644
--- a/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp
+++ b/src/Skeleton_blocker/example/Skeleton_blocker_link.cpp
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -28,11 +28,8 @@
#include <fstream>
#include <sstream>
-using namespace std;
-using namespace Gudhi;
-using namespace skbl;
-
-typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_simple_traits Traits;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_complex<Traits> Complex;
typedef Complex::Vertex_handle Vertex_handle;
typedef Complex::Root_vertex_handle Root_vertex_handle;
typedef Complex::Simplex Simplex;
@@ -47,25 +44,26 @@ int main(int argc, char *argv[]) {
Simplex tetrahedron(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3));
complex.add_simplex(tetrahedron);
- cout << "complex:" << complex.to_string() << endl;
+ std::cout << "complex:" << complex.to_string() << std::endl;
// build the link of vertex 1, eg a triangle {0,2,3}
auto link = complex.link(Vertex_handle(1));
- cout << "link:" << link.to_string() << endl;
+ std::cout << "link:" << link.to_string() << std::endl;
// Internally link is a subcomplex of 'complex' and its vertices are stored in a vector.
// They can be accessed via Vertex_handle(x) where x is an index of the vector.
// In that example, link has three vertices and thus it contains only
// Vertex_handle(0),Vertex_handle(1) and Vertex_handle(2) are).
for (int i = 0; i < 5; ++i)
- cout << "link.contains_vertex(Vertex_handle(" << i << ")):" << link.contains_vertex(Vertex_handle(i)) << endl;
- cout << endl;
+ std::cout << "link.contains_vertex(Vertex_handle(" << i << ")):" << link.contains_vertex(Vertex_handle(i)) <<
+ std::endl;
+ std::cout << std::endl;
// 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;
+ std::cout << "link.contains_vertex(Root_vertex_handle(" << i << ")):" <<
+ link.contains_vertex(Root_vertex_handle(i)) << std::endl;
return EXIT_SUCCESS;
}
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h
index 8584cd16..32fe411c 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h
@@ -1,24 +1,24 @@
- /* 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 <http://www.gnu.org/licenses/>.
- */
+/* 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
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
#ifndef SKELETON_BLOCKER_H_
#define SKELETON_BLOCKER_H_
@@ -35,13 +35,14 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
-/** \defgroup skbl Skeleton-Blocker
+/** \defgroup skbl Skeleton-Blocker
+@{
\author David Salinas
-\section Introduction
+\section skblintroduction Introduction
The Skeleton-Blocker data-structure proposes a light encoding for simplicial complexes by storing only an *implicit* representation of its
simplices
\cite socg_blockers_2011,\cite blockers2012.
@@ -52,7 +53,7 @@ This data-structure handles all simplicial complexes operations such as
are operations that do not require simplex enumeration such as edge iteration, link computation or simplex contraction.
-\section Definitions
+\section skbldefinitions Definitions
We recall briefly classical definitions of simplicial complexes
\cite Munkres-elementsalgtop1984.
@@ -63,7 +64,7 @@ when \f$ \tau \neq \sigma\f$ we say that \f$ \tau\f$ is a proper-face of \f$ \si
An abstract simplicial complex is a set of simplices that contains all the faces of its simplices.
The 1-skeleton of a simplicial complex (or its graph) consists of its elements of dimension lower than 2.
-*\image html "ds_representation.png" "Skeleton-blocker representation" width=20cm
+ *\image html "ds_representation.png" "Skeleton-blocker representation" width=20cm
To encode, a simplicial complex, one can encodes all its simplices.
@@ -85,7 +86,7 @@ in next figure. Storing the graph and blockers of such simplicial complexes is m
their simplices.
-*\image html "blockers_curve.png" "Number of blockers of random triangulations of 3-spheres" width=10cm
+ *\image html "blockers_curve.png" "Number of blockers of random triangulations of 3-spheres" width=10cm
@@ -107,7 +108,7 @@ and point access in addition.
-\subsection Visitor
+\subsection skblvisitor Visitor
The class Skeleton_blocker_complex has a visitor that is called when usual operations such as adding an edge or remove a vertex are called.
You may want to use this visitor to compute statistics or to update another data-structure (for instance this visitor is heavily used in the \ref contr package).
@@ -115,7 +116,7 @@ You may want to use this visitor to compute statistics or to update another data
-\section Example
+\section skblexample Example
\subsection Iterating Iterating through vertices, edges, blockers and simplices
@@ -127,46 +128,46 @@ such as the Simplex Tree. The following example computes the Euler Characteristi
of a simplicial complex.
\code{.cpp}
- typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex;
- typedef Complex::Vertex_handle Vertex_handle;
- typedef Complex::Simplex Simplex;
-
- const int n = 15;
-
- // build a full complex with 10 vertices and 2^n-1 simplices
- Complex complex;
- for(int i=0;i<n;i++)
- complex.add_vertex();
- for(int i=0;i<n;i++)
- for(int j=0;j<i;j++)
- complex.add_edge_without_blockers(Vertex_handle(i),Vertex_handle(j));
-
- // this is just to illustrate iterators, to count number of vertices
- // or edges, complex.num_vertices() and complex.num_edges() are
- // more appropriated!
- unsigned num_vertices = 0;
- for(auto v : complex.vertex_range()){
- ++num_vertices;
- }
-
- unsigned num_edges = 0;
- for(auto e : complex.edge_range())
- ++num_edges;
-
- unsigned euler = 0;
- unsigned num_simplices = 0;
- // 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.star_simplex_range()){
- ++num_simplices;
- if(s.dimension()%2 == 0)
- euler += 1;
- else
- euler -= 1;
- }
- std::cout << "Saw "<<num_vertices<<" vertices, "<<num_edges<<" edges and "<<num_simplices<<" simplices"<<std::endl;
- std::cout << "The Euler Characteristic is "<<euler<<std::endl;
+ typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex;
+ typedef Complex::Vertex_handle Vertex_handle;
+ typedef Complex::Simplex Simplex;
+
+ const int n = 15;
+
+ // build a full complex with 10 vertices and 2^n-1 simplices
+ Complex complex;
+ for(int i=0;i<n;i++)
+ complex.add_vertex();
+ for(int i=0;i<n;i++)
+ for(int j=0;j<i;j++)
+ complex.add_edge_without_blockers(Vertex_handle(i),Vertex_handle(j));
+
+ // this is just to illustrate iterators, to count number of vertices
+ // or edges, complex.num_vertices() and complex.num_edges() are
+ // more appropriated!
+ unsigned num_vertices = 0;
+ for(auto v : complex.vertex_range()){
+ ++num_vertices;
+ }
+
+ unsigned num_edges = 0;
+ for(auto e : complex.edge_range())
+ ++num_edges;
+
+ unsigned euler = 0;
+ unsigned num_simplices = 0;
+ // 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.star_simplex_range()){
+ ++num_simplices;
+ if(s.dimension()%2 == 0)
+ euler += 1;
+ else
+ euler -= 1;
+ }
+ std::cout << "Saw "<<num_vertices<<" vertices, "<<num_edges<<" edges and "<<num_simplices<<" simplices"<<std::endl;
+ std::cout << "The Euler Characteristic is "<<euler<<std::endl;
\endcode
@@ -181,43 +182,43 @@ The Euler Characteristic is 1
\subsection s Constructing a skeleton-blockers from a list of maximal faces or from a list of faces
\code{.cpp}
- std::vector<Simplex> simplices;
-
- //add 4 triangles of a tetrahedron 0123
- 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)));
-
- Complex complex;
- //get complex from top faces
- make_complex_from_top_faces(complex,simplices.begin(),simplices.end());
-
- std::cout << "Simplices:"<<std::endl;
- for(const Simplex & s : complex.star_simplex_range())
- std::cout << s << " ";
- std::cout << std::endl;
-
- //One blocker as simplex 0123 is not in the complex but all its proper faces are.
- std::cout << "Blockers: "<<complex.blockers_to_string()<<std::endl;
-
- //now build a complex from its full list of simplices
- simplices.clear();
- 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.star_simplex_range())
- std::cout << s << " ";
- std::cout << std::endl;
-
- //One blocker as simplex 012 is not in the complex but all its proper faces are.
- std::cout << "Blockers: "<<complex.blockers_to_string()<<std::endl;
+ std::vector<Simplex> simplices;
+
+ //add 4 triangles of a tetrahedron 0123
+ 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)));
+
+ Complex complex;
+ //get complex from top faces
+ make_complex_from_top_faces(complex,simplices.begin(),simplices.end());
+
+ std::cout << "Simplices:"<<std::endl;
+ for(const Simplex & s : complex.star_simplex_range())
+ std::cout << s << " ";
+ std::cout << std::endl;
+
+ //One blocker as simplex 0123 is not in the complex but all its proper faces are.
+ std::cout << "Blockers: "<<complex.blockers_to_string()<<std::endl;
+
+ //now build a complex from its full list of simplices
+ simplices.clear();
+ 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.star_simplex_range())
+ std::cout << s << " ";
+ std::cout << std::endl;
+
+ //One blocker as simplex 012 is not in the complex but all its proper faces are.
+ std::cout << "Blockers: "<<complex.blockers_to_string()<<std::endl;
\endcode
\verbatim
./SkeletonBlockerFromSimplices
@@ -236,14 +237,16 @@ The author wishes to thank Dominique Attali and André Lieutier for
their collaboration to write the two initial papers
\cite socg_blockers_2011,\cite blockers2012
about this data-structure
- and also Dominique for leaving him use a prototype.
+ and also Dominique for leaving him use a prototype.
-\copyright GNU General Public License v3.
-*/
-/** @} */ // end defgroup
+\copyright GNU General Public License v3.
-} // namespace skbl
+@} */
+
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h
index 4ade68e7..ba3636bc 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_SKELETON_BLOCKER_COMPLEX_VISITOR_H_
#define SKELETON_BLOCKER_SKELETON_BLOCKER_COMPLEX_VISITOR_H_
@@ -26,8 +27,8 @@
namespace Gudhi {
-namespace skbl {
-// todo rajouter les const
+namespace skeleton_blocker {
+// TODO(DS): to be constified
/**
*@class Skeleton_blocker_complex_visitor
@@ -36,7 +37,7 @@ namespace skbl {
template<typename Vertex_handle>
class Skeleton_blocker_complex_visitor {
public:
- virtual ~Skeleton_blocker_complex_visitor() {}
+ virtual ~Skeleton_blocker_complex_visitor() { }
virtual void on_add_vertex(Vertex_handle) = 0;
virtual void on_remove_vertex(Vertex_handle) = 0;
@@ -61,9 +62,9 @@ class Skeleton_blocker_complex_visitor {
virtual void on_swaped_edge(Vertex_handle a, Vertex_handle b,
Vertex_handle x) = 0;
virtual void on_add_blocker(
- const Skeleton_blocker_simplex<Vertex_handle>&) = 0;
+ const Skeleton_blocker_simplex<Vertex_handle>&) = 0;
virtual void on_delete_blocker(
- const Skeleton_blocker_simplex<Vertex_handle>*) = 0;
+ const Skeleton_blocker_simplex<Vertex_handle>*) = 0;
};
/**
@@ -73,24 +74,23 @@ class Skeleton_blocker_complex_visitor {
*/
template<typename Vertex_handle>
class Dummy_complex_visitor : public Skeleton_blocker_complex_visitor<
- Vertex_handle> {
+Vertex_handle> {
public:
- void on_add_vertex(Vertex_handle) {
- }
- void on_remove_vertex(Vertex_handle) {
- }
- void on_add_edge_without_blockers(Vertex_handle a, Vertex_handle b) {
- }
- void on_remove_edge(Vertex_handle a, Vertex_handle b) {
- }
- void on_changed_edge(Vertex_handle a, Vertex_handle b) {
- }
- void on_swaped_edge(Vertex_handle a, Vertex_handle b, Vertex_handle x) {
- }
- void on_add_blocker(const Skeleton_blocker_simplex<Vertex_handle>&) {
- }
- void on_delete_blocker(const Skeleton_blocker_simplex<Vertex_handle>*) {
- }
+ void on_add_vertex(Vertex_handle) { }
+
+ void on_remove_vertex(Vertex_handle) { }
+
+ void on_add_edge_without_blockers(Vertex_handle a, Vertex_handle b) { }
+
+ void on_remove_edge(Vertex_handle a, Vertex_handle b) { }
+
+ void on_changed_edge(Vertex_handle a, Vertex_handle b) { }
+
+ void on_swaped_edge(Vertex_handle a, Vertex_handle b, Vertex_handle x) { }
+
+ void on_add_blocker(const Skeleton_blocker_simplex<Vertex_handle>&) { }
+
+ void on_delete_blocker(const Skeleton_blocker_simplex<Vertex_handle>*) { }
};
/**
@@ -100,35 +100,44 @@ class Dummy_complex_visitor : public Skeleton_blocker_complex_visitor<
*/
template<typename Vertex_handle>
class Print_complex_visitor : public Skeleton_blocker_complex_visitor<
- Vertex_handle> {
+Vertex_handle> {
public:
void on_add_vertex(Vertex_handle v) {
std::cerr << "on_add_vertex:" << v << std::endl;
}
+
void on_remove_vertex(Vertex_handle v) {
std::cerr << "on_remove_vertex:" << v << std::endl;
}
+
void on_add_edge_without_blockers(Vertex_handle a, Vertex_handle b) {
std::cerr << "on_add_edge_without_blockers:" << a << "," << b << std::endl;
}
+
void on_remove_edge(Vertex_handle a, Vertex_handle b) {
std::cerr << "on_remove_edge:" << a << "," << b << std::endl;
}
+
void on_changed_edge(Vertex_handle a, Vertex_handle b) {
std::cerr << "on_changed_edge:" << a << "," << b << std::endl;
}
+
void on_swaped_edge(Vertex_handle a, Vertex_handle b, Vertex_handle x) {
std::cerr << "on_swaped_edge:" << a << "," << b << "," << x << std::endl;
}
+
void on_add_blocker(const Skeleton_blocker_simplex<Vertex_handle>& b) {
std::cerr << "on_add_blocker:" << b << std::endl;
}
+
void on_delete_blocker(const Skeleton_blocker_simplex<Vertex_handle>* b) {
std::cerr << "on_delete_blocker:" << b << std::endl;
}
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h
index 876bdba9..d4b60613 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_SKELETON_BLOCKER_LINK_SUPERIOR_H_
#define SKELETON_BLOCKER_SKELETON_BLOCKER_LINK_SUPERIOR_H_
@@ -26,7 +27,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
template<class ComplexType> class Skeleton_blocker_sub_complex;
@@ -36,7 +37,7 @@ template<class ComplexType> class Skeleton_blocker_sub_complex;
*/
template<typename ComplexType>
class Skeleton_blocker_link_superior : public Skeleton_blocker_link_complex<
- ComplexType> {
+ComplexType> {
typedef typename ComplexType::Edge_handle Edge_handle;
typedef typename ComplexType::boost_vertex_handle boost_vertex_handle;
@@ -54,23 +55,22 @@ class Skeleton_blocker_link_superior : public Skeleton_blocker_link_complex<
typedef typename ComplexType::Root_simplex_handle::Simplex_vertex_const_iterator IdSimplexConstIterator;
Skeleton_blocker_link_superior()
- : Skeleton_blocker_link_complex<ComplexType>(true) {
- }
+ : Skeleton_blocker_link_complex<ComplexType>(true) { }
Skeleton_blocker_link_superior(const ComplexType & parent_complex,
Simplex& alpha_parent_adress)
: Skeleton_blocker_link_complex<ComplexType>(parent_complex,
- alpha_parent_adress, true) {
- }
+ alpha_parent_adress, true) { }
Skeleton_blocker_link_superior(const ComplexType & parent_complex,
Vertex_handle a_parent_adress)
: Skeleton_blocker_link_complex<ComplexType>(parent_complex,
- a_parent_adress, true) {
- }
+ a_parent_adress, true) { }
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
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 ad2d2f85..747e60f1 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
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_SKELETON_BLOCKER_OFF_IO_H_
#define SKELETON_BLOCKER_SKELETON_BLOCKER_OFF_IO_H_
@@ -30,7 +31,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
*@brief Off reader visitor that can be passed to Off_reader to read a Skeleton_blocker_complex.
@@ -49,8 +50,8 @@ class Skeleton_blocker_off_flag_visitor_reader {
load_only_points_(load_only_points) { }
void init(int dim, int num_vertices, int num_faces, int num_edges) {
- // todo do an assert to check that this number are correctly read
- // todo reserve size for vector points
+ // TODO(DS): do an assert to check that this number are correctly read
+ // TODO(DS): reserve size for vector points
}
void point(const std::vector<double>& point) {
@@ -108,7 +109,7 @@ class Skeleton_blocker_off_visitor_reader {
void done() {
complex_ = make_complex_from_top_faces<Complex>(maximal_faces_.begin(), maximal_faces_.end(),
- points_.begin(), points_.end() );
+ points_.begin(), points_.end());
}
};
@@ -140,7 +141,7 @@ class Skeleton_blocker_off_reader {
}
/**
- * return true iff reading did not meet problems.
+ * return true if reading did not meet problems.
*/
bool is_valid() const {
return valid_;
@@ -193,7 +194,9 @@ class Skeleton_blocker_off_writer {
}
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h
index 8508d9a5..275376e6 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_SKELETON_BLOCKER_SIMPLE_GEOMETRIC_TRAITS_H_
#define SKELETON_BLOCKER_SKELETON_BLOCKER_SIMPLE_GEOMETRIC_TRAITS_H_
@@ -29,7 +30,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
* @extends SkeletonBlockerGeometricDS
@@ -39,7 +40,7 @@ namespace skbl {
*/
template<typename GeometryTrait>
struct Skeleton_blocker_simple_geometric_traits :
- public skbl::Skeleton_blocker_simple_traits {
+public Skeleton_blocker_simple_traits {
public:
typedef GeometryTrait GT;
typedef typename GT::Point Point;
@@ -57,19 +58,20 @@ struct Skeleton_blocker_simple_geometric_traits :
Point& point() {
return point_;
}
+
const Point& point() const {
return point_;
}
};
class Simple_geometric_edge :
- public Skeleton_blocker_simple_traits::Graph_edge {
+ public Skeleton_blocker_simple_traits::Graph_edge {
int index_;
public:
Simple_geometric_edge()
: Skeleton_blocker_simple_traits::Graph_edge(),
- index_(-1) {
- }
+ index_(-1) { }
+
/**
* @brief Allows to modify the index of the edge.
* The indices of the edge are used to store heap information
@@ -78,6 +80,7 @@ struct Skeleton_blocker_simple_geometric_traits :
int& index() {
return index_;
}
+
int index() const {
return index_;
}
@@ -87,7 +90,9 @@ struct Skeleton_blocker_simple_geometric_traits :
typedef Skeleton_blocker_simple_traits::Graph_edge Graph_edge;
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h
index 0d2de767..3835cf77 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_SKELETON_BLOCKER_SIMPLE_TRAITS_H_
#define SKELETON_BLOCKER_SKELETON_BLOCKER_SIMPLE_TRAITS_H_
@@ -29,7 +30,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
* @extends SkeletonBlockerDS
@@ -48,9 +49,9 @@ struct Skeleton_blocker_simple_traits {
*/
struct Root_vertex_handle {
typedef int boost_vertex_handle;
+
explicit Root_vertex_handle(boost_vertex_handle val = -1)
- : vertex(val) {
- }
+ : vertex(val) { }
boost_vertex_handle vertex;
bool operator!=(const Root_vertex_handle& other) const {
@@ -65,8 +66,8 @@ struct Skeleton_blocker_simple_traits {
return this->vertex < other.vertex;
}
- friend std::ostream& operator <<(std::ostream& o,
- const Root_vertex_handle & v) {
+ friend std::ostream& operator<<(std::ostream& o,
+ const Root_vertex_handle & v) {
o << v.vertex;
return o;
}
@@ -74,11 +75,13 @@ struct Skeleton_blocker_simple_traits {
struct Vertex_handle {
typedef int boost_vertex_handle;
+
explicit Vertex_handle(boost_vertex_handle val = -1)
- : vertex(val) {
- }
+ : vertex(val) { }
- operator int() const { return static_cast<int>(vertex); }
+ operator int() const {
+ return static_cast<int> (vertex);
+ }
boost_vertex_handle vertex;
@@ -94,7 +97,7 @@ struct Skeleton_blocker_simple_traits {
return this->vertex < other.vertex;
}
- friend std::ostream& operator <<(std::ostream& o, const Vertex_handle & v) {
+ friend std::ostream& operator<<(std::ostream& o, const Vertex_handle & v) {
o << v.vertex;
return o;
}
@@ -105,21 +108,24 @@ struct Skeleton_blocker_simple_traits {
Root_vertex_handle id_;
public:
- virtual ~Graph_vertex() {
- }
+ virtual ~Graph_vertex() { }
void activate() {
is_active_ = true;
}
+
void deactivate() {
is_active_ = false;
}
+
bool is_active() const {
return is_active_;
}
+
void set_id(Root_vertex_handle i) {
id_ = i;
}
+
Root_vertex_handle get_id() const {
return id_;
}
@@ -130,7 +136,7 @@ struct Skeleton_blocker_simple_traits {
return res.str();
}
- friend std::ostream& operator <<(std::ostream& o, const Graph_vertex & v) {
+ friend std::ostream& operator<<(std::ostream& o, const Graph_vertex & v) {
o << v.to_string();
return o;
}
@@ -144,13 +150,13 @@ struct Skeleton_blocker_simple_traits {
public:
Graph_edge()
: a_(-1),
- b_(-1),
- index_(-1) {
- }
+ b_(-1),
+ index_(-1) { }
int& index() {
return index_;
}
+
int index() const {
return index_;
}
@@ -168,14 +174,16 @@ struct Skeleton_blocker_simple_traits {
return b_;
}
- friend std::ostream& operator <<(std::ostream& o, const Graph_edge & v) {
+ friend std::ostream& operator<<(std::ostream& o, const Graph_edge & v) {
o << "(" << v.a_ << "," << v.b_ << " - id = " << v.index();
return o;
}
};
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
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 714bf23c..aa6f2215 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
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -33,7 +33,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
*@brief Abstract simplex used in Skeleton blockers data-structure.
@@ -63,7 +63,6 @@ class Skeleton_blocker_simplex {
*/
//@{
- // Skeleton_blocker_simplex():simplex_set() {}
void clear() {
simplex_set.clear();
}
@@ -89,8 +88,7 @@ class Skeleton_blocker_simplex {
add_vertex(v);
}
- void add_vertices() {
- }
+ void add_vertices() { }
/**
* Initialize a simplex with a string such as {0,1,2}
@@ -192,7 +190,6 @@ class Skeleton_blocker_simplex {
return simplex_set.crend();
}
-
typename std::set<T>::iterator begin() {
return simplex_set.begin();
}
@@ -236,6 +233,7 @@ class Skeleton_blocker_simplex {
assert(!empty());
return *(simplex_set.rbegin());
}
+
/**
* @return true iff the simplex contains the simplex a.
*/
@@ -351,8 +349,8 @@ class Skeleton_blocker_simplex {
//@}
- friend std::ostream& operator <<(std::ostream& o,
- const Skeleton_blocker_simplex & sigma) {
+ friend std::ostream& operator<<(std::ostream& o,
+ const Skeleton_blocker_simplex & sigma) {
bool first = true;
o << "{";
for (auto i : sigma) {
@@ -367,7 +365,9 @@ class Skeleton_blocker_simplex {
}
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
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 0dd5dd54..fadf6619 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
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -32,7 +32,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
* @brief Simplicial subcomplex of a complex represented by a skeleton/blockers pair.
@@ -159,7 +159,7 @@ class Skeleton_blocker_sub_complex : public ComplexType {
if (simplex.contains(*blocker)) {
Root_simplex_handle blocker_root(parent_complex.get_id(*(blocker)));
Simplex blocker_restr(
- *(this->get_simplex_address(blocker_root)));
+ *(this->get_simplex_address(blocker_root)));
this->add_blocker(new Simplex(blocker_restr));
}
}
@@ -190,14 +190,15 @@ class Skeleton_blocker_sub_complex : public ComplexType {
// */
// boost::optional<Simplex> get_address(const Root_simplex_handle & s) const;
-// private:
+ // private:
/**
* same as get_address except that it will return a simplex in any case.
* The vertices that were not found are not added.
*/
// @remark should be private but problem with VS
+
std::vector<boost::optional<Vertex_handle> > get_addresses(
- const Root_simplex_handle & s) const {
+ const Root_simplex_handle & s) const {
std::vector < boost::optional<Vertex_handle> > res;
for (auto i : s) {
res.push_back(get_address(i));
@@ -214,14 +215,14 @@ class Skeleton_blocker_sub_complex : public ComplexType {
*/
template<typename ComplexType>
bool proper_face_in_union(
- Skeleton_blocker_sub_complex<ComplexType> & link,
- std::vector<boost::optional<typename ComplexType::Vertex_handle> > & addresses_sigma_in_link,
- int vertex_to_be_ignored) {
+ Skeleton_blocker_sub_complex<ComplexType> & link,
+ std::vector<boost::optional<typename ComplexType::Vertex_handle> > & addresses_sigma_in_link,
+ std::size_t vertex_to_be_ignored) {
// we test that all vertices of 'addresses_sigma_in_link' but 'vertex_to_be_ignored'
// are in link1 if it is the case we construct the corresponding simplex
bool vertices_sigma_are_in_link = true;
typename ComplexType::Simplex sigma_in_link;
- for (int i = 0; i < addresses_sigma_in_link.size(); ++i) {
+ for (std::size_t i = 0; i < addresses_sigma_in_link.size(); ++i) {
if (i != vertex_to_be_ignored) {
if (!addresses_sigma_in_link[i]) {
vertices_sigma_are_in_link = false;
@@ -236,43 +237,24 @@ bool proper_face_in_union(
return vertices_sigma_are_in_link && link.contains(sigma_in_link);
}
-/*
- template<typename ComplexType>
- bool
- proper_faces_in_union(Skeleton_blocker_simplex<typename ComplexType::Root_vertex_handle> & sigma, Skeleton_blocker_sub_complex<ComplexType> & link1, Skeleton_blocker_sub_complex<ComplexType> & link2)
- {
- typedef typename ComplexType::Vertex_handle Vertex_handle;
- std::vector<boost::optional<Vertex_handle> > addresses_sigma_in_link1 = link1.get_addresses(sigma);
- std::vector<boost::optional<Vertex_handle> > addresses_sigma_in_link2 = link2.get_addresses(sigma);
-
- for (int current_index = 0; current_index < addresses_sigma_in_link1.size(); ++current_index)
- {
-
- if (!proper_face_in_union(link1, addresses_sigma_in_link1, current_index)
- && !proper_face_in_union(link2, addresses_sigma_in_link2, current_index)){
- return false;
- }
- }
- return true;
- }*/
-
// Remark: this function should be friend in order to leave get_adresses private
// however doing so seemes currently not possible due to a visual studio bug c2668
// "the compiler does not support partial ordering of template functions as specified in the C++ Standard"
// http://www.serkey.com/error-c2668-ambiguous-call-to-overloaded-function-bb45ft.html
+
template<typename ComplexType>
bool proper_faces_in_union(
- Skeleton_blocker_simplex<typename ComplexType::Root_vertex_handle> & sigma,
- Skeleton_blocker_sub_complex<ComplexType> & link1,
- Skeleton_blocker_sub_complex<ComplexType> & link2) {
+ Skeleton_blocker_simplex<typename ComplexType::Root_vertex_handle> & sigma,
+ Skeleton_blocker_sub_complex<ComplexType> & link1,
+ Skeleton_blocker_sub_complex<ComplexType> & link2) {
typedef typename ComplexType::Vertex_handle Vertex_handle;
std::vector < boost::optional<Vertex_handle> > addresses_sigma_in_link1 =
link1.get_addresses(sigma);
std::vector < boost::optional<Vertex_handle> > addresses_sigma_in_link2 =
link2.get_addresses(sigma);
- for (int current_index = 0; current_index < addresses_sigma_in_link1.size();
- ++current_index) {
+ for (std::size_t current_index = 0; current_index < addresses_sigma_in_link1.size();
+ ++current_index) {
if (!proper_face_in_union(link1, addresses_sigma_in_link1, current_index)
&& !proper_face_in_union(link2, addresses_sigma_in_link2,
current_index)) {
@@ -282,9 +264,10 @@ bool proper_faces_in_union(
return true;
}
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
#endif // SKELETON_BLOCKER_SKELETON_BLOCKER_SUB_COMPLEX_H_
-
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Top_faces.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Top_faces.h
index eb970195..2b681752 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Top_faces.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Top_faces.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_INTERNAL_TOP_FACES_H_
#define SKELETON_BLOCKER_INTERNAL_TOP_FACES_H_
@@ -28,7 +29,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
template<typename SimplexHandle>
std::list<SimplexHandle> subfaces(SimplexHandle top_face) {
@@ -63,8 +64,10 @@ void register_faces(std::vector< std::set<SimplexHandle> >& simplices_per_dimens
}
}
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
-#endif // SKELETON_BLOCKER_INTERNAL_TOP_FACES_H_
+#endif // SKELETON_BLOCKER_INTERNAL_TOP_FACES_H_
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h
index 499980c4..2c9602fa 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -21,7 +21,6 @@
*
*/
-
#ifndef SKELETON_BLOCKER_INTERNAL_TRIE_H_
#define SKELETON_BLOCKER_INTERNAL_TRIE_H_
@@ -32,7 +31,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
template<typename SimplexHandle>
struct Trie {
@@ -148,7 +147,7 @@ struct Trie {
}
void remove_leaf() {
- assert(is_leaf);
+ assert(is_leaf());
if (!is_root())
parent_->childs.erase(this);
}
@@ -240,7 +239,7 @@ struct Tries {
std::vector<Simplex> next_dimension_simplices() const {
std::vector<Simplex> res;
- while (!to_see_.empty() && to_see_.front()->simplex().dimension() == current_dimension_) {
+ while (!(to_see_.empty()) && (to_see_.front()->simplex().dimension() == current_dimension_)) {
res.emplace_back(to_see_.front()->simplex());
for (auto child : to_see_.front()->childs)
to_see_.push_back(child.get());
@@ -257,11 +256,13 @@ struct Tries {
private:
mutable std::deque<STrie*> to_see_;
- mutable unsigned current_dimension_ = 0;
+ mutable int current_dimension_ = 0;
std::vector<STrie*> cofaces_;
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h
index 4a437ac6..d2fff960 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_BLOCKERS_ITERATORS_H_
#define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_BLOCKERS_ITERATORS_H_
@@ -26,7 +27,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
* @brief Iterator through the blockers of a vertex.
@@ -124,7 +125,9 @@ ReturnType
}
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_edges_iterators.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_edges_iterators.h
index ef4c7970..b90dcf34 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_edges_iterators.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_edges_iterators.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_
#define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_
@@ -29,7 +30,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
template<typename SkeletonBlockerComplex>
class Edge_around_vertex_iterator : public boost::iterator_facade <Edge_around_vertex_iterator<SkeletonBlockerComplex>
@@ -137,7 +138,9 @@ class Edge_iterator : public boost::iterator_facade <Edge_iterator<SkeletonBlock
}
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_iterators.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_iterators.h
index cc3ed276..1351614f 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_iterators.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_iterators.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
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 b8d99201..2acdb555 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
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_SIMPLICES_ITERATORS_H_
#define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_SIMPLICES_ITERATORS_H_
@@ -35,7 +36,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
* Link may be Skeleton_blocker_link_complex<SkeletonBlockerComplex> to iterate over all
@@ -61,17 +62,18 @@ public boost::iterator_facade < Simplex_around_vertex_iterator<SkeletonBlockerCo
// 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<Simplex> Trie;
+ typedef typename Gudhi::skeleton_blocker::Trie<Simplex> Trie;
private:
const Complex* complex;
Vertex_handle v;
std::shared_ptr<Link> link_v;
std::shared_ptr<Trie> trie;
- std::list<Trie*> nodes_to_be_seen; // todo deque
+ // TODO(DS): use a deque instead
+ std::list<Trie*> nodes_to_be_seen;
public:
- Simplex_around_vertex_iterator() : complex(0) {}
+ Simplex_around_vertex_iterator() : complex(0) { }
Simplex_around_vertex_iterator(const Complex* complex_, Vertex_handle v_) :
complex(complex_),
@@ -81,15 +83,16 @@ public boost::iterator_facade < Simplex_around_vertex_iterator<SkeletonBlockerCo
compute_trie_and_nodes_to_be_seen();
}
- // todo avoid useless copy
- // todo currently just work if copy begin iterator
+ // TODO(DS): avoid useless copy
+ // TODO(DS): 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()) {}
+ if (!other.is_end()) {
+ }
}
/**
@@ -159,7 +162,8 @@ public boost::iterator_facade < Simplex_around_vertex_iterator<SkeletonBlockerCo
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
+ // one is empty the other is not
+ if (!both_non_empty) return false;
bool same_node = (**(nodes_to_be_seen.begin()) == **(other.nodes_to_be_seen.begin()));
return same_node;
@@ -238,7 +242,6 @@ public boost::iterator_facade < Simplex_iterator<SkeletonBlockerComplex>
}
private:
- // todo return to private
Simplex_iterator(const Complex* complex, bool end) :
complex_(complex) {
set_end();
@@ -306,7 +309,7 @@ public boost::iterator_facade < Simplex_iterator<SkeletonBlockerComplex>
/**
* Iterator through the maximal faces of the coboundary of a simplex.
- */
+ */
template<typename SkeletonBlockerComplex, typename Link>
class Simplex_coboundary_iterator :
public boost::iterator_facade < Simplex_coboundary_iterator<SkeletonBlockerComplex, Link>
@@ -329,12 +332,12 @@ public boost::iterator_facade < Simplex_coboundary_iterator<SkeletonBlockerCompl
Complex_vertex_iterator link_vertex_end;
public:
- Simplex_coboundary_iterator() : complex(0) {}
+ Simplex_coboundary_iterator() : complex(0) { }
Simplex_coboundary_iterator(const Complex* complex_, const Simplex& sigma_) :
complex(complex_),
sigma(sigma_),
- //need only vertices of the link hence the true flag
+ // need only vertices of the link hence the true flag
link(new Link(*complex_, sigma_, false, true)) {
auto link_vertex_range = link->vertex_range();
current_vertex = link_vertex_range.begin();
@@ -347,9 +350,9 @@ public boost::iterator_facade < Simplex_coboundary_iterator<SkeletonBlockerCompl
link(other.link),
current_vertex(other.current_vertex),
link_vertex_end(other.link_vertex_end) { }
-
+
// returns an iterator to the end
- Simplex_coboundary_iterator(const Complex* complex_,const Simplex& sigma_, bool end) :
+ Simplex_coboundary_iterator(const Complex* complex_, const Simplex& sigma_, bool end) :
complex(complex_),
sigma(sigma_) {
// to represent an end iterator without having to build a useless link, we use
@@ -361,7 +364,7 @@ public boost::iterator_facade < Simplex_coboundary_iterator<SkeletonBlockerCompl
return complex->convert_handle_from_another_complex(*link, link_vh);
}
-public:
+ public:
friend std::ostream& operator<<(std::ostream& stream, const Simplex_coboundary_iterator& sci) {
return stream;
}
@@ -369,8 +372,8 @@ public:
// assume that iterator points to the same complex and comes from the same simplex
bool equal(const Simplex_coboundary_iterator& other) const {
assert(complex == other.complex && sigma == other.sigma);
- if(is_end()) return other.is_end();
- if(other.is_end()) return is_end();
+ if (is_end()) return other.is_end();
+ if (other.is_end()) return is_end();
return *current_vertex == *(other.current_vertex);
}
@@ -384,14 +387,15 @@ public:
return res;
}
-private:
+ private:
bool is_end() const {
return !link || current_vertex == link_vertex_end;
}
};
+} // namespace skeleton_blocker
-} // namespace skbl
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h
index 116023d7..736941dd 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_TRIANGLES_ITERATORS_H_
#define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_TRIANGLES_ITERATORS_H_
@@ -27,7 +28,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
* \brief Iterator over the triangles that are
@@ -135,7 +136,7 @@ typename SkeletonBlockerComplex::Simplex const
Triangle_iterator(const SkeletonBlockerComplex* complex) :
complex_(complex),
current_vertex_(complex->vertex_range().begin()),
- current_triangle_(complex, *current_vertex_), // xxx this line is problematic is the complex is empty
+ current_triangle_(complex, *current_vertex_), // this line is problematic is the complex is empty
is_end_(false) {
assert(!complex->empty());
gotoFirstTriangle();
@@ -172,7 +173,8 @@ typename SkeletonBlockerComplex::Simplex const
bool both_arent_finished = !is_finished() && !other.is_finished();
// if the two iterators are not finished, they must have the same state
return (complex_ == other.complex_) && (both_are_finished || ((both_arent_finished) &&
- current_vertex_ == other.current_vertex_ && current_triangle_ == other.current_triangle_));
+ current_vertex_ == other.current_vertex_ &&
+ current_triangle_ == other.current_triangle_));
}
Simplex dereference() const {
@@ -183,8 +185,10 @@ typename SkeletonBlockerComplex::Simplex const
// goto the next vertex that has a triangle pending or the
// end vertex iterator if none exists
void goto_next_vertex() {
- assert(current_triangle_.finished()); // we mush have consume all triangles passing through the vertex
- assert(!is_finished()); // we must not be done
+ // we must have consume all triangles passing through the vertex
+ assert(current_triangle_.finished());
+ // we must not be done
+ assert(!is_finished());
++current_vertex_;
@@ -213,7 +217,9 @@ typename SkeletonBlockerComplex::Simplex const
}
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_vertices_iterators.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_vertices_iterators.h
index 14ae136a..9e9ae961 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_vertices_iterators.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_vertices_iterators.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
#define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
@@ -28,7 +29,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
*@brief Iterator on the vertices of a simplicial complex
@@ -103,7 +104,7 @@ class Vertex_iterator : public boost::iterator_facade< Vertex_iterator <Skeleton
};
template<typename SkeletonBlockerComplex>
-class Neighbors_vertices_iterator: public boost::iterator_facade < Neighbors_vertices_iterator<SkeletonBlockerComplex>
+class Neighbors_vertices_iterator : public boost::iterator_facade < Neighbors_vertices_iterator<SkeletonBlockerComplex>
, typename SkeletonBlockerComplex::Vertex_handle const
, boost::forward_traversal_tag
, typename SkeletonBlockerComplex::Vertex_handle const> {
@@ -122,9 +123,6 @@ class Neighbors_vertices_iterator: public boost::iterator_facade < Neighbors_ver
boost_adjacency_iterator end_;
public:
- // boost_adjacency_iterator ai, ai_end;
- // for (tie(ai, ai_end) = adjacent_vertices(v.vertex, skeleton); ai != ai_end; ++ai) {
-
Neighbors_vertices_iterator() : complex(NULL) { }
Neighbors_vertices_iterator(const Complex* complex_, Vertex_handle v_) :
@@ -157,16 +155,16 @@ class Neighbors_vertices_iterator: public boost::iterator_facade < Neighbors_ver
}
private:
- // todo remove this ugly hack
+ // TODO(DS): remove this ugly hack
void set_end() {
current_ = end_;
}
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
#endif // SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
-
-
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h
index fd85f0c2..4f052ba5 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -52,7 +52,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
*@class Skeleton_blocker_complex
@@ -211,7 +211,6 @@ class Skeleton_blocker_complex {
add_edge_without_blockers(e.first, e.second);
}
-
template<typename SimpleHandleOutputIterator>
void add_blockers(SimpleHandleOutputIterator simplices_begin, SimpleHandleOutputIterator simplices_end) {
Tries<Simplex> tries(num_vertices(), simplices_begin, simplices_end);
@@ -414,7 +413,8 @@ class Skeleton_blocker_complex {
/**
*/
bool contains_vertex(Vertex_handle u) const {
- if (u.vertex < 0 || u.vertex >= boost::num_vertices(skeleton))
+ Vertex_handle num_vertices(boost::num_vertices(skeleton));
+ if (u.vertex < 0 || u.vertex >= num_vertices)
return false;
return (*this)[u].is_active();
}
@@ -441,11 +441,11 @@ class Skeleton_blocker_complex {
* @brief Given an Id return the address of the vertex having this Id in the complex.
* @remark For a simplicial complex, the address is the id but it may not be the case for a SubComplex.
*/
- virtual boost::optional<Vertex_handle> get_address(
- Root_vertex_handle id) const {
+ virtual boost::optional<Vertex_handle> get_address(Root_vertex_handle id) const {
boost::optional<Vertex_handle> res;
- if (id.vertex < boost::num_vertices(skeleton))
- res = Vertex_handle(id.vertex); // xxx
+ int num_vertices = boost::num_vertices(skeleton);
+ if (id.vertex < num_vertices)
+ res = Vertex_handle(id.vertex);
return res;
}
@@ -560,7 +560,7 @@ class Skeleton_blocker_complex {
return res;
}
- /**
+ /**
* @brief Adds all edges of s in the complex.
*/
void add_edge(const Simplex& s) {
@@ -591,7 +591,6 @@ class Skeleton_blocker_complex {
return *edge_handle;
}
-
/**
* @brief Adds all edges of s in the complex without adding blockers.
*/
@@ -844,12 +843,13 @@ class Skeleton_blocker_complex {
boost_adjacency_iterator ai, ai_end;
for (tie(ai, ai_end) = adjacent_vertices(v.vertex, skeleton); ai != ai_end;
++ai) {
+ Vertex_handle value(*ai);
if (keep_only_superior) {
- if (*ai > v.vertex) {
- n.add_vertex(Vertex_handle(*ai));
+ if (value > v.vertex) {
+ n.add_vertex(value);
}
} else {
- n.add_vertex(Vertex_handle(*ai));
+ n.add_vertex(value);
}
}
}
@@ -929,7 +929,7 @@ class Skeleton_blocker_complex {
// xxx rename get_address et place un using dans sub_complex
boost::optional<Simplex> get_simplex_address(
- const Root_simplex_handle& s) const {
+ const Root_simplex_handle& s) const {
boost::optional<Simplex> res;
Simplex s_address;
@@ -1001,10 +1001,9 @@ class Skeleton_blocker_complex {
return std::distance(triangles.begin(), triangles.end());
}
-
/*
* @brief returns the number of simplices of a given dimension in the complex.
- */
+ */
size_t num_simplices() const {
auto simplices = complex_simplex_range();
return std::distance(simplices.begin(), simplices.end());
@@ -1012,8 +1011,8 @@ class Skeleton_blocker_complex {
/*
* @brief returns the number of simplices of a given dimension in the complex.
- */
- size_t num_simplices(unsigned dimension) const {
+ */
+ size_t num_simplices(int dimension) const {
// TODO(DS): iterator on k-simplices
size_t res = 0;
for (const auto& s : complex_simplex_range())
@@ -1595,7 +1594,9 @@ Complex make_complex_from_top_faces(SimplexHandleIterator simplices_begin, Simpl
return Complex(simplices.begin(), simplices.end(), is_flag_complex);
}
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
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 040f7950..95331b7a 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_geometric_complex.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_GEOMETRIC_COMPLEX_H_
#define SKELETON_BLOCKER_GEOMETRIC_COMPLEX_H_
@@ -28,7 +29,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
* @brief Class that represents a geometric complex that can be simplified.
@@ -217,7 +218,9 @@ SkeletonBlockerGeometricComplex make_complex_from_top_faces(
return complex;
}
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_link_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_link_complex.h
index e3c16d88..4db075b0 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_link_complex.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_link_complex.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_LINK_COMPLEX_H_
#define SKELETON_BLOCKER_LINK_COMPLEX_H_
@@ -27,7 +28,7 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
template<class ComplexType> class Skeleton_blocker_sub_complex;
@@ -39,7 +40,7 @@ template<class ComplexType> class Skeleton_blocker_sub_complex;
*/
template<typename ComplexType>
class Skeleton_blocker_link_complex : public Skeleton_blocker_sub_complex<
- ComplexType> {
+ComplexType> {
template<typename T> friend class Skeleton_blocker_link_superior;
typedef typename ComplexType::Edge_handle Edge_handle;
@@ -60,8 +61,7 @@ class Skeleton_blocker_link_complex : public Skeleton_blocker_sub_complex<
typedef typename ComplexType::Root_simplex_handle::Simplex_vertex_const_iterator Root_simplex_handle_iterator;
explicit Skeleton_blocker_link_complex(bool only_superior_vertices = false)
- : only_superior_vertices_(only_superior_vertices) {
- }
+ : only_superior_vertices_(only_superior_vertices) { }
/**
* If the parameter only_superior_vertices is true,
@@ -95,10 +95,10 @@ class Skeleton_blocker_link_complex : public Skeleton_blocker_sub_complex<
*/
Skeleton_blocker_link_complex(const ComplexType & parent_complex,
Edge_handle edge, bool only_superior_vertices =
- false)
+ false)
: only_superior_vertices_(only_superior_vertices) {
Simplex alpha_simplex(parent_complex.first_vertex(edge),
- parent_complex.second_vertex(edge));
+ parent_complex.second_vertex(edge));
build_link(parent_complex, alpha_simplex);
}
@@ -151,7 +151,7 @@ class Skeleton_blocker_link_complex : public Skeleton_blocker_sub_complex<
bool only_superior_vertices) {
// for a vertex we know exactly the number of vertices of the link (and the size of the corresponding vector
this->skeleton.m_vertices.reserve(
- parent_complex.degree(alpha_parent_adress));
+ parent_complex.degree(alpha_parent_adress));
// For all vertex 'v' in this intersection, we go through all its adjacent blockers.
// If one blocker minus 'v' is included in alpha then the vertex is not in the link complex.
@@ -169,21 +169,21 @@ class Skeleton_blocker_link_complex : public Skeleton_blocker_sub_complex<
return;
for (auto x_link = this->vertex_range().begin();
- x_link != this->vertex_range().end(); ++x_link) {
+ x_link != this->vertex_range().end(); ++x_link) {
for (auto y_link = x_link; ++y_link != this->vertex_range().end();) {
Vertex_handle x_parent = *parent_complex.get_address(
- this->get_id(*x_link));
+ this->get_id(*x_link));
Vertex_handle y_parent = *parent_complex.get_address(
- this->get_id(*y_link));
+ this->get_id(*y_link));
if (parent_complex.contains_edge(x_parent, y_parent)) {
// we check that there is no blocker subset of alpha passing trough x and y
bool new_edge = true;
for (auto blocker_parent : parent_complex.const_blocker_range(
- x_parent)) {
+ x_parent)) {
if (!is_alpha_blocker || *blocker_parent != alpha_parent_adress) {
if (blocker_parent->contains(y_parent)) {
new_edge = !(alpha_parent_adress.contains_difference(
- *blocker_parent, x_parent, y_parent));
+ *blocker_parent, x_parent, y_parent));
if (!new_edge)
break;
}
@@ -201,8 +201,8 @@ class Skeleton_blocker_link_complex : public Skeleton_blocker_sub_complex<
* corresponding address in 'other_complex'.
* It assumes that other_complex have a vertex 'this.get_id(address)'
*/
- boost::optional<Vertex_handle> give_equivalent_vertex(
- const ComplexType & other_complex, Vertex_handle address) const {
+ boost::optional<Vertex_handle> give_equivalent_vertex(const ComplexType & other_complex,
+ Vertex_handle address) const {
Root_vertex_handle id((*this)[address].get_id());
return other_complex.get_address(id);
}
@@ -269,7 +269,7 @@ class Skeleton_blocker_link_complex : public Skeleton_blocker_sub_complex<
bool only_vertices = false) {
assert(is_alpha_blocker || parent_complex.contains(alpha_parent_adress));
compute_link_vertices(parent_complex, alpha_parent_adress, only_superior_vertices_);
- if(!only_vertices) {
+ if (!only_vertices) {
compute_link_edges(parent_complex, alpha_parent_adress, is_alpha_blocker);
compute_link_blockers(parent_complex, alpha_parent_adress, is_alpha_blocker);
}
@@ -290,7 +290,9 @@ class Skeleton_blocker_link_complex : public Skeleton_blocker_sub_complex<
}
};
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
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 94a125c1..544e02e8 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef SKELETON_BLOCKER_SIMPLIFIABLE_COMPLEX_H_
#define SKELETON_BLOCKER_SIMPLIFIABLE_COMPLEX_H_
@@ -30,10 +31,10 @@
namespace Gudhi {
-namespace skbl {
+namespace skeleton_blocker {
/**
- * Returns true iff the blocker 'sigma' is popable.
+ * Returns true if the blocker 'sigma' is popable.
* To define popable, let us call 'L' the complex that
* consists in the current complex without the blocker 'sigma'.
* A blocker 'sigma' is then "popable" if the link of 'sigma'
@@ -145,8 +146,7 @@ void Skeleton_blocker_complex<SkeletonBlockerDS>::remove_star(Vertex_handle v) {
* whenever the dimension of tau is at least 2.
*/
template<typename SkeletonBlockerDS>
-void Skeleton_blocker_complex<SkeletonBlockerDS>::update_blockers_after_remove_star_of_vertex_or_edge(
- const Simplex& simplex_to_be_removed) {
+void Skeleton_blocker_complex<SkeletonBlockerDS>::update_blockers_after_remove_star_of_vertex_or_edge(const Simplex& simplex_to_be_removed) {
std::list <Blocker_handle> blockers_to_update;
if (simplex_to_be_removed.empty()) return;
@@ -224,8 +224,6 @@ void Skeleton_blocker_complex<SkeletonBlockerDS>::add_simplex(const Simplex& sig
add_blockers_after_simplex_insertion(sigma);
}
-
-
template<typename SkeletonBlockerDS>
void Skeleton_blocker_complex<SkeletonBlockerDS>::add_blockers_after_simplex_insertion(Simplex sigma) {
if (sigma.dimension() < 1) return;
@@ -385,7 +383,8 @@ Skeleton_blocker_complex<SkeletonBlockerDS>::contract_edge(Vertex_handle a, Vert
template<typename SkeletonBlockerDS>
void Skeleton_blocker_complex<SkeletonBlockerDS>::get_blockers_to_be_added_after_contraction(Vertex_handle a,
- Vertex_handle b, std::set<Simplex>& blockers_to_add) {
+ Vertex_handle b,
+ std::set<Simplex>& blockers_to_add) {
blockers_to_add.clear();
typedef Skeleton_blocker_link_complex<Skeleton_blocker_complex<SkeletonBlockerDS> > LinkComplexType;
@@ -459,7 +458,9 @@ Skeleton_blocker_complex<SkeletonBlockerDS>::notify_changed_edges(Vertex_handle
}
-} // namespace skbl
+} // namespace skeleton_blocker
+
+namespace skbl = skeleton_blocker;
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/test/CMakeLists.txt b/src/Skeleton_blocker/test/CMakeLists.txt
index 5e063845..f98517f0 100644
--- a/src/Skeleton_blocker/test/CMakeLists.txt
+++ b/src/Skeleton_blocker/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIskbl)
+project(Skeleton_blocker_tests)
if (GCOVR_PATH)
# for gcovr to make coverage reports - Corbera Jenkins plugin
@@ -10,15 +10,26 @@ if (GPROF_PATH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif()
-add_executable(TestSkeletonBlockerComplex TestSkeletonBlockerComplex.cpp)
-add_executable(TestSimplifiable TestSimplifiable.cpp)
-add_executable(TestGeometricComplex TestGeometricComplex.cpp)
+add_executable ( test_skeleton_blocker_complex test_skeleton_blocker_complex.cpp )
+target_link_libraries(test_skeleton_blocker_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( test_skeleton_blocker_geometric_complex test_skeleton_blocker_geometric_complex.cpp )
+target_link_libraries(test_skeleton_blocker_geometric_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( test_skeleton_blocker_simplifiable test_skeleton_blocker_simplifiable.cpp )
+target_link_libraries(test_skeleton_blocker_simplifiable ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
# Do not forget to copy test files in current binary dir
-file(COPY "test.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY "test2.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-add_test(TestSkeletonBlockerComplex ${CMAKE_CURRENT_BINARY_DIR}/TestSkeletonBlockerComplex)
-add_test(TestSimplifiable ${CMAKE_CURRENT_BINARY_DIR}/TestSimplifiable)
-add_test(TestGeometricComplex ${CMAKE_CURRENT_BINARY_DIR}/TestGeometricComplex)
-
+# Unitary tests
+add_test(NAME test_skeleton_blocker_complex
+ COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_skeleton_blocker_complex
+ # XML format for Jenkins xUnit plugin
+ --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/skbl_complexUT.xml --log_level=test_suite --report_level=no)
+add_test(NAME test_skeleton_blocker_geometric_complex
+ COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_skeleton_blocker_geometric_complex
+ # XML format for Jenkins xUnit plugin
+ --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/skbl_geometric_complexUT.xml --log_level=test_suite --report_level=no)
+add_test(NAME test_skeleton_blocker_simplifiable
+ COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_skeleton_blocker_simplifiable
+ # XML format for Jenkins xUnit plugin
+ --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/skbl_simplifiableUT.xml --log_level=test_suite --report_level=no)
diff --git a/src/Skeleton_blocker/test/TestGeometricComplex.cpp b/src/Skeleton_blocker/test/TestGeometricComplex.cpp
deleted file mode 100644
index 084e2b6b..00000000
--- a/src/Skeleton_blocker/test/TestGeometricComplex.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/* 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 <http://www.gnu.org/licenses/>.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
-#include <fstream>
-#include <sstream>
-#include "gudhi/Test.h"
-#include "gudhi/Skeleton_blocker.h"
-
-
-using namespace std;
-using namespace Gudhi;
-using namespace skbl;
-
-struct Geometry_trait {
- typedef std::vector<double> Point;
-};
-
-typedef Geometry_trait::Point Point;
-typedef Skeleton_blocker_simple_geometric_traits<Geometry_trait> Complex_geometric_traits;
-typedef Skeleton_blocker_geometric_complex< Complex_geometric_traits > Complex;
-typedef Complex::Vertex_handle Vertex_handle;
-
-bool test_constructor1() {
- Complex complex;
- Skeleton_blocker_off_reader<Complex> off_reader("test2.off", complex);
- if (!off_reader.is_valid()) {
- std::cerr << "Unable to read file" << std::endl;
- return false;
- }
-
-
- std::cout << "complex has " <<
- complex.num_vertices() << " vertices, " <<
- complex.num_blockers() << " blockers, " <<
- complex.num_edges() << " edges and" <<
- complex.num_triangles() << " triangles.";
-
- if (complex.num_vertices() != 7 || complex.num_edges() != 12 || complex.num_triangles() != 6)
- return false;
-
- Skeleton_blocker_off_writer<Complex> off_writer("tmp.off", complex);
- Complex same;
- Skeleton_blocker_off_reader<Complex> off_reader2("tmp.off", same);
-
- std::cout << "\ncomplex:" << complex.to_string() << endl;
- std::cout << "\nsame:" << same.to_string() << endl;
-
- return (complex == same);
-}
-
-bool test_constructor2() {
- Complex complex;
- Skeleton_blocker_off_reader<Complex> off_reader("test2.off", complex);
- if (!off_reader.is_valid()) {
- std::cerr << "Unable to read file" << std::endl;
- return false;
- }
- std::cout << "complex has " <<
- complex.num_vertices() << " vertices, " <<
- complex.num_blockers() << " blockers, " <<
- complex.num_edges() << " edges and" <<
- complex.num_triangles() << " triangles.";
-
- if (complex.num_vertices() != 7 || complex.num_edges() != 12 || complex.num_triangles() != 6)
- return false;
-
- auto link_0 = complex.abstract_link(Vertex_handle(0));
-
-
- std::cout << "\n link(0):" << link_0.to_string() << endl;
-
- auto link_geometric_0 = complex.link(Vertex_handle(0));
-
- auto print_point = [&](Vertex_handle v) {
- for (auto x : link_geometric_0.point(v)) std::cout << x << " ";
- std::cout << std::endl;
- };
-
- std::for_each(link_geometric_0.vertex_range().begin(), link_geometric_0.vertex_range().end(), print_point);
-
- // for(auto v : link_geometric_0.vertex_range())
- // std::cout<<"point("<<v<<"):"<<link_geometric_0.point(v)<<std::endl;
-
- return link_0.num_vertices() == 2;
-}
-
-int main(int argc, char *argv[]) {
- Tests tests_geometric_complex;
- tests_geometric_complex.add("Test constructor 1", test_constructor1);
- tests_geometric_complex.add("Test constructor 2", test_constructor2);
-
- if (tests_geometric_complex.run())
- return EXIT_SUCCESS;
- else
- return EXIT_FAILURE;
-}
diff --git a/src/Skeleton_blocker/test/TestSkeletonBlockerComplex.cpp b/src/Skeleton_blocker/test/test_skeleton_blocker_complex.cpp
index 2a3f0501..4f9888ba 100644
--- a/src/Skeleton_blocker/test/TestSkeletonBlockerComplex.cpp
+++ b/src/Skeleton_blocker/test/test_skeleton_blocker_complex.cpp
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -24,22 +24,18 @@
#include <string>
#include <fstream>
#include <sstream>
-#include "gudhi/Debug_utils.h"
-#include "gudhi/Test.h"
-#include "gudhi/Skeleton_blocker.h"
-//#include "gudhi/Skeleton_blocker_link_complex.h"
-//#include "gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h"
-//#include "gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h"
-//#include "gudhi/Skeleton_blocker/internal/Trie.h"
-using namespace std;
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE "skeleton_blocker_complex"
+#include <boost/test/unit_test.hpp>
+#include <boost/mpl/list.hpp>
-using namespace Gudhi;
+#include <gudhi/Skeleton_blocker.h>
-using namespace skbl;
-
-
-typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex;
+template<typename ComplexType> class Skeleton_blocker_sub_complex;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_simple_traits Traits;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_complex<Traits> Complex;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_link_complex<Complex> Skeleton_blocker_link_complex;
typedef Complex::Vertex_handle Vertex_handle;
typedef Complex::Root_vertex_handle Root_vertex_handle;
typedef Complex::Simplex Simplex;
@@ -47,8 +43,6 @@ typedef Complex::Root_simplex_handle Root_simplex_handle;
typedef Simplex::Simplex_vertex_const_iterator Simplex_vertex_const_iterator;
typedef Complex::Edge_handle Edge_handle;
-// true if v in complex
-
bool assert_vertex(Complex &complex, Vertex_handle v) {
//assert(complex.contains(v));
return complex.contains(static_cast<Simplex> (v));
@@ -80,75 +74,59 @@ void build_complete(int n, Complex& complex) {
for (int i = 0; i < n; i++)
complex.add_vertex();
- // for(int i=n-1;i>=0;i--)
- // for(int j=i-1;j>=0;j--)
- // complex.add_edge_without_blockers(Vertex_handle(i),Vertex_handle(j));
-
for (int i = 0; i < n; i++)
for (int j = 0; j < i; j++)
complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(j));
}
-bool test_simplex() {
- // PRINT("test simplex");
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplex) {
Simplex simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3));
- for (auto i = simplex.begin(); i != simplex.end(); ++i) {
- PRINT(*i);
- auto j = i;
- for (++j;
- j != simplex.end();
- ++j) {
- PRINT(*j);
- }
- }
- return simplex.dimension() == 3;
+ BOOST_CHECK(simplex.dimension() == 3);
}
-bool test_num_simplices() {
+BOOST_AUTO_TEST_CASE(test_skeleton_num_simplices) {
int n = 4;
Complex complex;
build_complete(n, complex);
size_t sum = 0;
for (int i = 0; i < n; i++) {
- PRINT(complex.num_simplices(i));
sum += complex.num_simplices(i);
}
- return
- complex.num_vertices() == n &&
- complex.num_edges() == 6 &&
- sum == 15 &&
- complex.num_simplices() == 15;
+ BOOST_CHECK(complex.num_vertices() == n);
+ BOOST_CHECK(complex.num_edges() == 6);
+ BOOST_CHECK(sum == 15);
+ BOOST_CHECK(complex.num_simplices() == 15);
}
-bool test_iterator_vertices1() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_vertices1) {
int n = 10;
Complex complex(10);
- cerr << "complex.num_vertices():" << complex.num_vertices() << endl;
+ std::cout << "complex.num_vertices():" << complex.num_vertices() << std::endl;
int num_vertex_seen = 0;
for (auto vi : complex.vertex_range()) {
- cerr << "vertex:" << vi << endl;
+ std::cout << "vertex:" << vi << std::endl;
++num_vertex_seen;
}
- return num_vertex_seen == n;
+ BOOST_CHECK(num_vertex_seen == n);
}
-bool test_iterator_vertices2() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_vertices2) {
int n = 10;
Complex complex;
build_complete(10, complex);
- cerr << "complex.num_vertices():" << complex.num_vertices() << endl;
- cerr << "complex.num_edges():" << complex.num_edges() << endl;
+ std::cout << "complex.num_vertices():" << complex.num_vertices() << std::endl;
+ std::cout << "complex.num_edges():" << complex.num_edges() << std::endl;
int num_vertex_seen = 0;
for (auto vi : complex.vertex_range(Vertex_handle(2))) {
- cerr << "vertex:" << vi << endl;
+ std::cout << "vertex:" << vi << std::endl;
++num_vertex_seen;
}
- std::cerr << "num_vertex_seen:" << num_vertex_seen << std::endl;
- return num_vertex_seen == (n - 1);
+ std::cout << "num_vertex_seen:" << num_vertex_seen << std::endl;
+ BOOST_CHECK(num_vertex_seen == (n -1));
}
-bool test_iterator_edge() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_edge) {
const int n = 10;
Complex complex(n);
for (int i = 0; i < n; i++)
@@ -156,17 +134,17 @@ bool test_iterator_edge() {
complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(j));
complex.remove_edge(Vertex_handle(2), Vertex_handle(3));
complex.remove_edge(Vertex_handle(3), Vertex_handle(5));
- cerr << "complex.num_edges():" << complex.num_edges() << endl;
+ std::cout << "complex.num_edges():" << complex.num_edges() << std::endl;
int num_edges_seen = 0;
for (auto edge : complex.edge_range()) {
- cerr << "edge :" << complex[edge] << endl;
+ std::cout << "edge :" << complex[edge] << std::endl;
++num_edges_seen;
}
- return num_edges_seen == n * (n - 1) / 2 - 2;
+ BOOST_CHECK(num_edges_seen == n * (n - 1) / 2 - 2);
}
-bool test_iterator_edge2() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_edge2) {
const int n = 10;
Complex complex(n);
for (int i = 0; i < n; i++)
@@ -174,33 +152,16 @@ bool test_iterator_edge2() {
complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(j));
complex.remove_edge(Vertex_handle(2), Vertex_handle(3));
complex.remove_edge(Vertex_handle(3), Vertex_handle(5));
- cerr << "complex.num_edges():" << complex.num_edges() << endl;
+ std::cout << "complex.num_edges():" << complex.num_edges() << std::endl;
int num_neigbors_seen = 0;
for (auto neighbor : complex.vertex_range(Vertex_handle(2))) {
- cerr << "neighbor" << neighbor << endl;
+ std::cout << "neighbor" << neighbor << std::endl;
++num_neigbors_seen;
}
- return num_neigbors_seen == 8;
+ BOOST_CHECK(num_neigbors_seen == 8);
}
-bool test_iterator_edge3() {
- const int n = 10;
- Complex complex(n);
- for (int i = 0; i < n; i++)
- for (int j = 0; j < i; j++)
- complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(j));
- complex.remove_edge(Vertex_handle(2), Vertex_handle(3));
- complex.remove_edge(Vertex_handle(3), Vertex_handle(5));
- cerr << "complex.num_edges():" << complex.num_edges() << endl;
- int num_neigbors_seen = 0;
- for (auto edge : complex.edge_range(Vertex_handle(2))) {
- std::cerr << edge << std::endl;
- ++num_neigbors_seen;
- }
- return num_neigbors_seen == 8;
-}
-
-bool test_iterator_triangles() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_triangles) {
const int n = 7;
Complex complex(n);
//create a "ring" around '0'
@@ -210,24 +171,20 @@ bool test_iterator_triangles() {
complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(i + 1));
complex.add_edge_without_blockers(Vertex_handle(1), Vertex_handle(6));
- PRINT(complex.to_string());
+ std::cout << complex.to_string() << std::endl;
int num_triangles_seen = 0;
//for (auto t : complex.triangle_range(5)){
- TEST("triangles around 5 (should be 2 of them):");
for (auto t : complex.triangle_range(Vertex_handle(5))) {
- PRINT(t);
++num_triangles_seen;
}
- bool test = (num_triangles_seen == 2);
+ BOOST_CHECK(num_triangles_seen == 2);
num_triangles_seen = 0;
- TEST("triangles around 0 (should be 6 of them):");
for (auto t : complex.triangle_range(Vertex_handle(0))) {
- PRINT(t);
++num_triangles_seen;
}
- test = test && (num_triangles_seen == 6);
+ BOOST_CHECK(num_triangles_seen == 6);
// we now add another triangle
complex.add_vertex();
@@ -236,22 +193,14 @@ bool test_iterator_triangles() {
complex.add_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(6)));
num_triangles_seen = 0;
- TEST("triangles (should be 6 of them):");
num_triangles_seen = 0;
for (auto t : complex.triangle_range()) {
- PRINT(t);
++num_triangles_seen;
}
- test = test && (num_triangles_seen == 6);
- PRINT(num_triangles_seen);
-
- return test;
+ BOOST_CHECK(num_triangles_seen == 6);
}
-
-//#include "combinatorics/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h"
-
-bool test_iterator_simplices() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_simplices) {
Complex complex(6);
complex.add_edge_without_blockers(Vertex_handle(0), Vertex_handle(1));
complex.add_edge_without_blockers(Vertex_handle(1), Vertex_handle(2));
@@ -266,8 +215,6 @@ bool test_iterator_simplices() {
complex.add_blocker(Simplex(Vertex_handle(2), Vertex_handle(3), Vertex_handle(4), Vertex_handle(5)));
- bool correct_number_simplices = true;
-
std::map<Vertex_handle, unsigned> expected_num_simplices;
expected_num_simplices[Vertex_handle(0)] = 4;
@@ -278,120 +225,108 @@ bool test_iterator_simplices() {
expected_num_simplices[Vertex_handle(5)] = 7;
for (auto pair : expected_num_simplices) {
+ std::cout << "found list: ";
unsigned num_simplices_around = 0;
for (const auto& simplex : complex.star_simplex_range(pair.first)) {
simplex.dimension();
- DBGVALUE(simplex);
+ std::cout << simplex << " - ";
++num_simplices_around;
}
- correct_number_simplices = correct_number_simplices && (num_simplices_around == pair.second);
+ BOOST_CHECK(num_simplices_around == pair.second);
- DBGMSG("current vertex:", pair.first);
- DBGMSG("expected_num_simplices:", pair.second);
- DBGMSG("found:", num_simplices_around);
+ std::cout << std::endl << "current vertex:" << pair.first << " - ";
+ std::cout << "expected_num_simplices:" << pair.second << " - ";
+ std::cout << "found:" << num_simplices_around << std::endl;
}
- return correct_number_simplices;
}
-bool test_iterator_simplices2() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_simplices2) {
Complex complex(2);
complex.add_edge_without_blockers(Vertex_handle(0), Vertex_handle(1));
- for (const auto& s : complex.triangle_range()) {
- s.dimension();
- return false; // there are no triangles
- }
-
- unsigned num_simplices = 0;
-
-
- DBGVALUE(complex.to_string());
-
- for (const auto& simplex : complex.star_simplex_range(Vertex_handle(0))) {
- simplex.dimension();
- DBGVALUE(simplex);
- }
-
+ // Check there is no triangle
+ BOOST_CHECK(std::distance(complex.triangle_range().begin(), complex.triangle_range().end()) == 0);
- for (const auto& simplex : complex.complex_simplex_range()) {
- DBGVALUE(simplex);
- simplex.dimension();
- ++num_simplices;
- }
- bool correct_number_simplices = (num_simplices == 3);
- return correct_number_simplices;
+ // Star(0) is [{0},{0,1}]
+ BOOST_CHECK(std::distance(complex.star_simplex_range(Vertex_handle(0)).begin(),
+ complex.star_simplex_range(Vertex_handle(0)).end()) == 2);
+
+ // No blocker
+ BOOST_CHECK(std::distance(complex.blocker_range(Vertex_handle(0)).begin(),
+ complex.blocker_range(Vertex_handle(0)).end()) == 0);
+
+ // Complex is [{0},{0,1},{1}]
+ BOOST_CHECK(std::distance(complex.complex_simplex_range().begin(),
+ complex.complex_simplex_range().end()) == 3);
}
-bool test_iterator_simplices3() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_simplices3) {
Complex complex(3);
complex.add_edge_without_blockers(Vertex_handle(0), Vertex_handle(1));
complex.add_edge_without_blockers(Vertex_handle(1), Vertex_handle(2));
complex.add_edge_without_blockers(Vertex_handle(2), Vertex_handle(0));
complex.add_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2)));
- unsigned num_simplices = 0;
-
- for (const auto& simplex : complex.star_simplex_range(Vertex_handle(0))) {
- simplex.dimension();
- DBGVALUE(simplex);
- }
+ // Check there is no triangle
+ BOOST_CHECK(std::distance(complex.triangle_range().begin(), complex.triangle_range().end()) == 0);
+ // Star(0) is [{0},{0,1},{0,2}]
+ BOOST_CHECK(std::distance(complex.star_simplex_range(Vertex_handle(0)).begin(),
+ complex.star_simplex_range(Vertex_handle(0)).end()) == 3);
- for (const auto& simplex : complex.complex_simplex_range()) {
- DBGVALUE(simplex);
- simplex.dimension();
- ++num_simplices;
- }
- bool correct_number_simplices = (num_simplices == 6);
- return correct_number_simplices;
+ // blocker(0) is [{0,1,2}]
+ BOOST_CHECK(std::distance(complex.blocker_range(Vertex_handle(0)).begin(),
+ complex.blocker_range(Vertex_handle(0)).end()) == 1);
+
+ // Complex is [{0},{0,1},{0,2},{1},{1,2},{2}]
+ BOOST_CHECK(std::distance(complex.complex_simplex_range().begin(),
+ complex.complex_simplex_range().end()) == 6);
}
-bool test_iterator_simplices4() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_simplices4) {
Complex empty_complex;
for (auto v : empty_complex.vertex_range()) {
- (void) v;
+ std::cout << v;
+ BOOST_CHECK(false);
}
for (auto e : empty_complex.edge_range()) {
- empty_complex[e];
+ std::cout << e;
+ BOOST_CHECK(false);
}
for (auto t : empty_complex.triangle_range()) {
- t.dimension();
+ std::cout << t;
+ BOOST_CHECK(false);
}
for (auto s : empty_complex.complex_simplex_range()) {
- s.dimension();
+ std::cout << s;
+ BOOST_CHECK(false);
}
- return true;
}
-bool test_iterator_coboundary() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_coboundary) {
Complex c;
build_complete(4, c);
c.remove_edge(Vertex_handle(1), Vertex_handle(3));
- PRINT(c.to_string());
+ std::cout << c.to_string();
Simplex s02(Vertex_handle(0), Vertex_handle(2));
int n = 0;
std::set<Simplex> expected;
expected.insert(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2)));
expected.insert(Simplex(Vertex_handle(0), Vertex_handle(2), Vertex_handle(3)));
for (const auto & s : c.coboundary_range(s02)) {
- PRINT(s);
- if (expected.find(s) == expected.end())
- return false;
+ BOOST_CHECK(expected.find(s) != expected.end());
++n;
}
- return n == 2;
+ BOOST_CHECK(n == 2);
}
-
-
-
template<typename Map>
auto blocker_range(Map map) -> decltype(map | boost::adaptors::map_values) {
return map | boost::adaptors::map_values;
}
-bool test_iterator_blockers() {
+BOOST_AUTO_TEST_CASE(test_skeleton_iterator_blockers) {
Complex complex;
Simplex alpha;
Simplex vertex_set_expected;
@@ -404,58 +339,62 @@ bool test_iterator_blockers() {
complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(j));
}
- complex.add_blocker(Simplex(Vertex_handle(10), Vertex_handle(11), Vertex_handle(12)));
- complex.add_blocker(Simplex(Vertex_handle(2), Vertex_handle(1), Vertex_handle(10)));
- complex.add_blocker(Simplex(Vertex_handle(10), Vertex_handle(9), Vertex_handle(15)));
- complex.add_blocker(Simplex(Vertex_handle(1), Vertex_handle(9), Vertex_handle(8)));
+ std::vector<Simplex> myBlockers;
+ myBlockers.push_back(Simplex(Vertex_handle(10), Vertex_handle(11), Vertex_handle(12)));
+ myBlockers.push_back(Simplex(Vertex_handle(2), Vertex_handle(1), Vertex_handle(10)));
+ myBlockers.push_back(Simplex(Vertex_handle(10), Vertex_handle(9), Vertex_handle(15)));
+ myBlockers.push_back(Simplex(Vertex_handle(1), Vertex_handle(9), Vertex_handle(8)));
+
+ for (auto blocker : myBlockers)
+ complex.add_blocker(blocker);
- // Print result
int num_blockers = 0;
for (auto blockers : complex.blocker_range(Vertex_handle(10))) {
- TESTVALUE(*blockers);
+ // Only the first 3 blockers contain vertex 10
+ BOOST_CHECK(*blockers == myBlockers[num_blockers]);
num_blockers++;
}
- bool test = (num_blockers == 3);
+ BOOST_CHECK(num_blockers == 3);
num_blockers = 0;
for (auto blockers : complex.blocker_range()) {
- TESTVALUE(*blockers);
+// If not windows - _WIN32 is for windows 32 and 64 bits
+#ifndef _WIN32
+ for (auto block_ptr = myBlockers.begin(); block_ptr < myBlockers.end(); block_ptr++)
+ if (*block_ptr == *blockers)
+ myBlockers.erase(block_ptr);
+#endif
num_blockers++;
}
- test = test && (num_blockers == 4);
-
- return test;
+ BOOST_CHECK(num_blockers == 4);
+// If not windows - _WIN32 is for windows 32 and 64 bits
+#ifndef _WIN32
+ BOOST_CHECK(myBlockers.empty());
+#endif
}
-bool test_link0() {
-
- enum {
- a, b, c, d, n
- };
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_link0) {
+ enum { a, b, c, d, n };
Complex complex(n);
complex.add_edge_without_blockers(Vertex_handle(b), Vertex_handle(c));
complex.add_edge_without_blockers(Vertex_handle(c), Vertex_handle(d));
Simplex alpha = Simplex(Vertex_handle(c));
- Skeleton_blocker_link_complex<Complex> L(complex, alpha);
+ Skeleton_blocker_link_complex L(complex, alpha);
auto L2 = complex.link(alpha);
- if (L != L2) return false;
-
- PRINT(L.num_vertices());
- PRINT(L.to_string());
+ BOOST_CHECK(L == L2);
- bool test1 = L.contains_vertex(*L.get_address(Root_vertex_handle(b)));
- bool test2 = L.contains_vertex(*L.get_address(Root_vertex_handle(d)));
- bool test3 = L.num_edges() == 0;
- bool test4 = L.num_blockers() == 0;
- return test1 && test2 && test3&&test4;
+ std::cout << L.to_string();
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(b))));
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(d))));
+ BOOST_CHECK(L.num_edges() == 0);
+ BOOST_CHECK(L.num_blockers() == 0);
}
-bool test_link1() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_link1) {
Complex complex;
-
// Build the complexes
for (int i = 0; i < 20; i++) {
complex.add_vertex();
@@ -465,30 +404,27 @@ bool test_link1() {
complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(j));
}
Simplex alpha(Vertex_handle(12), Vertex_handle(14));
- Skeleton_blocker_link_complex<Complex> L(complex, alpha);
+ Skeleton_blocker_link_complex L(complex, alpha);
// Complexes built
auto L2 = complex.link(alpha);
- if (L != L2) return false;
+ BOOST_CHECK(L == L2);
// verification
- bool test1 = L.contains_vertex(*L.get_address(Root_vertex_handle(10)));
- bool test2 = L.contains_vertex(*L.get_address(Root_vertex_handle(11)));
- bool test3 = L.contains_vertex(*L.get_address(Root_vertex_handle(13)));
- bool test4 = L.num_edges() == 3;
- bool test5 = L.num_blockers() == 0;
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(10))));
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(11))));
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(13))));
+ BOOST_CHECK(L.num_edges() == 3);
+ BOOST_CHECK(L.num_blockers() == 0);
Root_simplex_handle simplex;
simplex.add_vertex(Root_vertex_handle(10));
simplex.add_vertex(Root_vertex_handle(11));
simplex.add_vertex(Root_vertex_handle(13));
- bool test6(L.get_simplex_address(simplex));
- bool test7 = L.contains(*(L.get_simplex_address(simplex)));
- cerr << "----> Ocomplex \n";
- return test1 && test2 && test3 && test4 && test5 && test6&&test7;
-
+ BOOST_CHECK(L.get_simplex_address(simplex));
+ BOOST_CHECK(L.contains(*(L.get_simplex_address(simplex))));
}
-bool test_link2() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_link2) {
Complex complex;
Simplex alpha;
@@ -503,34 +439,32 @@ bool test_link2() {
}
complex.add_blocker(Simplex(Vertex_handle(10), Vertex_handle(11), Vertex_handle(13)));
alpha = Simplex(Vertex_handle(12), Vertex_handle(14));
- Skeleton_blocker_link_complex<Complex> L(complex, alpha);
+ Skeleton_blocker_link_complex L(complex, alpha);
// Complexes built
// Print result
- cerr << "complex complex" << complex.to_string();
- cerr << endl << endl;
- cerr << "L= Link_complex(" << alpha << ") : \n" << L.to_string();
+ std::cout << "complex complex" << complex.to_string();
+ std::cout << std::endl << std::endl;
+ std::cout << "L= Link_complex(" << alpha << ") : \n" << L.to_string();
auto L2 = complex.link(alpha);
- if (L != L2) return false;
+ BOOST_CHECK(L == L2);
// verification
- bool test1 = L.contains_vertex(*L.get_address(Root_vertex_handle(10)));
- bool test2 = L.contains_vertex(*L.get_address(Root_vertex_handle(11)));
- bool test3 = L.contains_vertex(*L.get_address(Root_vertex_handle(13)));
- bool test4 = L.num_edges() == 3;
- bool test5 = L.num_blockers() == 1;
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(10))));
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(11))));
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(13))));
+ BOOST_CHECK(L.num_edges() == 3);
+ BOOST_CHECK(L.num_blockers() == 1);
Root_simplex_handle simplex;
simplex.add_vertex(Root_vertex_handle(10));
simplex.add_vertex(Root_vertex_handle(11));
simplex.add_vertex(Root_vertex_handle(13));
- bool test6 = L.contains_blocker(*(L.get_simplex_address(simplex)));
- cerr << "----> Ocomplex \n";
- return test1 && test2 && test3 && test4 && test5&&test6;
+ BOOST_CHECK(L.contains_blocker(*(L.get_simplex_address(simplex))));
}
-bool test_link3() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_link3) {
Complex complex;
Simplex alpha;
@@ -545,30 +479,28 @@ bool test_link3() {
}
complex.add_blocker(Simplex(Vertex_handle(10), Vertex_handle(11), Vertex_handle(12)));
alpha = Simplex(Vertex_handle(12), Vertex_handle(14));
- Skeleton_blocker_link_complex<Complex> L(complex, alpha);
+ Skeleton_blocker_link_complex L(complex, alpha);
// Complexes built
// Print result
- cerr << "complex complex" << complex.to_string();
- cerr << endl << endl;
- cerr << "L= Link_complex(" << alpha << ") : \n" << L.to_string();
+ std::cout << "complex complex" << complex.to_string();
+ std::cout << std::endl << std::endl;
+ std::cout << "L= Link_complex(" << alpha << ") : \n" << L.to_string();
auto L2 = complex.link(alpha);
- if (L != L2) return false;
-
+ BOOST_CHECK(L == L2);
// verification
- bool test = assert_vertex(L, *L.get_address(Root_vertex_handle(10)));
- test = test && assert_vertex(L, *L.get_address(Root_vertex_handle(11)));
- test = test && assert_vertex(L, *L.get_address(Root_vertex_handle(13)));
- test = test && L.num_edges() == 2;
- test = test && L.contains_edge(*L.get_address(Root_vertex_handle(10)), *L.get_address(Root_vertex_handle(13)));
- test = test && L.contains_edge(*L.get_address(Root_vertex_handle(13)), *L.get_address(Root_vertex_handle(11)));
- test = test && L.num_blockers() == 0;
- return test;
+ BOOST_CHECK(L.contains(static_cast<Simplex> (*L.get_address(Root_vertex_handle(10)))));
+ BOOST_CHECK(L.contains(static_cast<Simplex> (*L.get_address(Root_vertex_handle(11)))));
+ BOOST_CHECK(L.contains(static_cast<Simplex> (*L.get_address(Root_vertex_handle(13)))));
+ BOOST_CHECK(L.num_edges() == 2);
+ BOOST_CHECK(L.contains_edge(*L.get_address(Root_vertex_handle(10)), *L.get_address(Root_vertex_handle(13))));
+ BOOST_CHECK(L.contains_edge(*L.get_address(Root_vertex_handle(13)), *L.get_address(Root_vertex_handle(11))));
+ BOOST_CHECK(L.num_blockers() == 0);
}
-bool test_link4() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_link4) {
Complex complex;
// Build the complexes
@@ -581,46 +513,41 @@ bool test_link4() {
}
complex.add_blocker(Simplex(Vertex_handle(10), Vertex_handle(11), Vertex_handle(12), Vertex_handle(13)));
Simplex alpha(Vertex_handle(12), Vertex_handle(14));
- Skeleton_blocker_link_complex<Complex> L(complex, alpha);
+ Skeleton_blocker_link_complex L(complex, alpha);
// Complexes built
// verification
- bool test1 = L.contains_vertex(*L.get_address(Root_vertex_handle(10)));
- bool test2 = L.contains_vertex(*L.get_address(Root_vertex_handle(11)));
- bool test3 = L.contains_vertex(*L.get_address(Root_vertex_handle(13)));
- bool test4 = L.num_edges() == 3;
- bool test5 = L.num_blockers() == 1;
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(10))));
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(11))));
+ BOOST_CHECK(L.contains_vertex(*L.get_address(Root_vertex_handle(13))));
+ BOOST_CHECK(L.num_edges() == 3);
+ BOOST_CHECK(L.num_blockers() == 1);
Root_simplex_handle simplex;
simplex.add_vertex(Root_vertex_handle(10));
simplex.add_vertex(Root_vertex_handle(11));
simplex.add_vertex(Root_vertex_handle(13));
- bool test6 = L.contains_blocker(*(L.get_simplex_address(simplex)));
- cerr << "----> Ocomplex \n";
- return test1 && test2 && test3 && test4 && test5&&test6;
-
+ BOOST_CHECK(L.contains_blocker(*(L.get_simplex_address(simplex))));
}
-bool test_link5() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_link5) {
Complex complex(0);
// Build the complexes
build_complete(4, complex);
complex.add_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3)));
Simplex alpha(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2));
-
-
- Skeleton_blocker_link_complex<Complex> L(complex, alpha); // Complexes built
+ Skeleton_blocker_link_complex L(complex, alpha);
+ // Complexes built
// Print result
- PRINT(complex.to_string());
- cerr << endl << endl;
- PRINT(L.to_string());
+ std::cout << "Complex: " << complex.to_string()<< std::endl << std::endl;
+ std::cout << "Link: " << L.to_string() << std::endl;
// verification
- return L.num_vertices() == 0;
+ BOOST_CHECK(L.num_vertices() == 0);
}
-bool test_link6() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_link6) {
Complex complex(0);
// Build the complexes
build_complete(4, complex);
@@ -628,20 +555,19 @@ bool test_link6() {
Simplex alpha(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2));
- Skeleton_blocker_link_complex<Complex> link_blocker_alpha;
+ Skeleton_blocker_link_complex link_blocker_alpha;
build_link_of_blocker(complex, alpha, link_blocker_alpha);
// Print result
- PRINT(complex.to_string());
- cerr << endl << endl;
- PRINT(link_blocker_alpha.to_string());
+ std::cout << "Complex: " << complex.to_string()<< std::endl << std::endl;
+ std::cout << "Link: " << link_blocker_alpha.to_string() << std::endl;
// verification
- return link_blocker_alpha.num_vertices() == 1;
+ BOOST_CHECK(link_blocker_alpha.num_vertices() == 1);
}
-bool test_link7() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_link7) {
Complex complex(0);
// Build the complexes
build_complete(6, complex);
@@ -657,38 +583,33 @@ bool test_link7() {
Simplex alpha(Vertex_handle(3), Vertex_handle(4), Vertex_handle(5));
- Skeleton_blocker_link_complex<Complex> link_blocker_alpha;
+ Skeleton_blocker_link_complex link_blocker_alpha;
build_link_of_blocker(complex, alpha, link_blocker_alpha);
//the result should be the edge {6,7} plus the blocker {0,1,2}
// Print result
- PRINT(complex.to_string());
- cerr << endl << endl;
- DBGVALUE(link_blocker_alpha.to_string());
+ std::cout << "Complex: " << complex.to_string()<< std::endl << std::endl;
+ std::cout << "Link: " << link_blocker_alpha.to_string() << std::endl;
- Skeleton_blocker_link_complex<Complex> link_blocker_alpha_cpy = link_blocker_alpha;
+ Skeleton_blocker_link_complex link_blocker_alpha_cpy = link_blocker_alpha;
- DBGVALUE(link_blocker_alpha_cpy.to_string());
+ std::cout << "Link copy: " << link_blocker_alpha_cpy.to_string() << std::endl;
- bool equal_complexes =
- (link_blocker_alpha.num_vertices() == link_blocker_alpha_cpy.num_vertices())
- &&(link_blocker_alpha.num_blockers() == link_blocker_alpha_cpy.num_blockers())
- &&(link_blocker_alpha.num_edges() == link_blocker_alpha_cpy.num_edges())
- ;
- DBGVALUE((link_blocker_alpha.num_blockers() == link_blocker_alpha_cpy.num_blockers()));
- DBGVALUE((link_blocker_alpha.num_blockers()));
- DBGVALUE((link_blocker_alpha_cpy.num_blockers()));
-
- DBGVALUE(equal_complexes);
+ BOOST_CHECK(link_blocker_alpha.num_vertices() == link_blocker_alpha_cpy.num_vertices());
+ BOOST_CHECK(link_blocker_alpha.num_blockers() == link_blocker_alpha_cpy.num_blockers());
+ BOOST_CHECK(link_blocker_alpha.num_edges() == link_blocker_alpha_cpy.num_edges());
+ BOOST_CHECK((link_blocker_alpha.num_blockers() == link_blocker_alpha_cpy.num_blockers()));
// verification
- return link_blocker_alpha.num_vertices() == 5 && link_blocker_alpha.num_edges() == 4 && link_blocker_alpha.num_blockers() == 1 && equal_complexes;
+ BOOST_CHECK(link_blocker_alpha.num_vertices() == 5);
+ BOOST_CHECK(link_blocker_alpha.num_edges() == 4);
+ BOOST_CHECK(link_blocker_alpha.num_blockers() == 1);
}
template<typename SimplexHandle>
-void add_triangle_edges(int a, int b, int c, list<SimplexHandle>& simplices) {
+void add_triangle_edges(int a, int b, int c, std::list<SimplexHandle>& simplices) {
typedef SimplexHandle Simplex;
typedef typename SimplexHandle::Vertex_handle Vertex_handle;
@@ -698,14 +619,14 @@ void add_triangle_edges(int a, int b, int c, list<SimplexHandle>& simplices) {
}
template<typename SimplexHandle>
-void add_triangle(int a, int b, int c, list<SimplexHandle>& simplices) {
+void add_triangle(int a, int b, int c, std::list<SimplexHandle>& simplices) {
typedef SimplexHandle Simplex;
typedef typename SimplexHandle::Vertex_handle Vertex_handle;
simplices.push_back(Simplex(Vertex_handle(a), Vertex_handle(b), Vertex_handle(c)));
}
-bool test_constructor() {
- list <Simplex> simplices;
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_constructor) {
+ std::list <Simplex> simplices;
simplices.push_back(Simplex(Vertex_handle(0)));
simplices.push_back(Simplex(Vertex_handle(1)));
@@ -722,7 +643,6 @@ bool test_constructor() {
add_triangle_edges(1, 3, 4, simplices);
add_triangle_edges(1, 2, 4, simplices);
-
add_triangle(0, 1, 5, simplices);
add_triangle(1, 2, 3, simplices);
add_triangle(1, 3, 4, simplices);
@@ -731,13 +651,15 @@ bool test_constructor() {
Complex complex(simplices.begin(), simplices.end());
- PRINT(complex.to_string());
+ std::cout << "Constructor 1:\n" << complex.to_string();
- return ( complex.num_vertices() == 6 && complex.num_edges() == 10 && complex.num_blockers() == 2);
+ BOOST_CHECK(complex.num_vertices() == 6);
+ BOOST_CHECK(complex.num_edges() == 10);
+ BOOST_CHECK(complex.num_blockers() == 2);
}
-list<Simplex> subfaces(Simplex top_face) {
- list<Simplex> res;
+std::list<Simplex> subfaces(Simplex top_face) {
+ std::list<Simplex> res;
if (top_face.dimension() == -1) return res;
if (top_face.dimension() == 0) {
res.push_back(top_face);
@@ -746,7 +668,7 @@ list<Simplex> subfaces(Simplex top_face) {
Vertex_handle first_vertex = top_face.first_vertex();
top_face.remove_vertex(first_vertex);
res = subfaces(top_face);
- list<Simplex> copy = res;
+ std::list<Simplex> copy = res;
for (auto& simplex : copy) {
simplex.add_vertex(first_vertex);
}
@@ -756,47 +678,50 @@ list<Simplex> subfaces(Simplex top_face) {
}
}
-bool test_constructor2() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_constructor2) {
Simplex simplex;
for (int i = 0; i < 5; ++i)
simplex.add_vertex(static_cast<Vertex_handle> (i));
- list <Simplex> simplices(subfaces(simplex));
+ std::list <Simplex> simplices(subfaces(simplex));
simplices.remove(simplex);
Complex complex(simplices.begin(), simplices.end());
- PRINT(complex.to_string());
+ std::cout << "Constructor 2:\n" << complex.to_string();
for (auto b : complex.const_blocker_range()) {
- cout << "b:" << b << endl;
+ std::cout << "b:" << b << std::endl;
}
- return ( complex.num_vertices() == 5 && complex.num_edges() == 10 && complex.num_blockers() == 1);
+ BOOST_CHECK(complex.num_vertices() == 5);
+ BOOST_CHECK(complex.num_edges() == 10);
+ BOOST_CHECK(complex.num_blockers() == 1);
}
-bool test_constructor3() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_constructor3) {
typedef Vertex_handle Vh;
typedef Simplex Sh;
std::vector<Simplex> simplices;
auto subf(subfaces(Sh(Vh(0), Vh(1), Vh(2))));
subf.pop_back(); //remove max face -> now a blocker 012
simplices.insert(simplices.begin(), subf.begin(), subf.end());
- DBGCONT(simplices);
+
Complex complex(simplices.begin(), simplices.end());
- DBGVALUE(complex.to_string());
+ std::cout << "Constructor 3:\n" << complex.to_string();
- if (complex.num_blockers() != 1) return false;
+ BOOST_CHECK(complex.num_blockers() == 1);
Sh expected_blocker(Vh(0), Vh(1), Vh(2));
for (auto b : complex.const_blocker_range())
- if (*b != expected_blocker) return false;
+ BOOST_CHECK(*b == expected_blocker);
- return complex.num_vertices() == 3 && complex.num_blockers() == 1;
+ BOOST_CHECK(complex.num_vertices() == 3);
+ BOOST_CHECK(complex.num_blockers() == 1);
}
-bool test_constructor4() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_constructor4) {
typedef Vertex_handle Vh;
typedef Simplex Sh;
std::vector<Simplex> simplices;
@@ -807,19 +732,20 @@ bool test_constructor4() {
simplices.push_back(Sh(Vh(4), Vh(1)));
simplices.push_back(Sh(Vh(4), Vh(0)));
- DBGCONT(simplices);
Complex complex(simplices.begin(), simplices.end());
- DBGVALUE(complex.to_string());
- if (complex.num_blockers() != 1) return false;
+ std::cout << "Constructor 4:\n" << complex.to_string();
+ BOOST_CHECK(complex.num_blockers() == 1);
Sh expected_blocker(Vh(0), Vh(1), Vh(4));
for (auto b : complex.const_blocker_range())
- if (*b != expected_blocker) return false;
+ BOOST_CHECK(*b == expected_blocker);
- return complex.num_vertices() == 5 && complex.num_blockers() == 1 && complex.num_edges() == 8;
+ BOOST_CHECK(complex.num_vertices() == 5);
+ BOOST_CHECK(complex.num_blockers() == 1);
+ BOOST_CHECK(complex.num_edges() == 8);
}
-bool test_constructor5() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_constructor5) {
typedef Vertex_handle Vh;
typedef Simplex Sh;
std::vector<Simplex> simplices;
@@ -836,15 +762,16 @@ bool test_constructor5() {
simplices.push_back(Sh(Vh(5), Vh(2)));
simplices.push_back(Sh(Vh(5), Vh(0)));
- DBGCONT(simplices);
Complex complex(simplices.begin(), simplices.end());
- DBGVALUE(complex.to_string());
+ std::cout << "Constructor 5:\n" << complex.to_string();
- return complex.num_vertices() == 6 && complex.num_blockers() == 3 && complex.num_edges() == 9;
+ BOOST_CHECK(complex.num_vertices() == 6);
+ BOOST_CHECK(complex.num_blockers() == 3);
+ BOOST_CHECK(complex.num_edges() == 9);
}
-bool test_constructor6() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_constructor6) {
typedef Vertex_handle Vh;
typedef Simplex Sh;
std::vector<Simplex> simplices;
@@ -855,19 +782,19 @@ bool test_constructor6() {
if (s != s1 && s != s2) simplices.push_back(s);
}
- DBGCONT(simplices);
Complex complex(simplices.begin(), simplices.end());
- DBGVALUE(complex.to_string());
+ std::cout << "Constructor 6:\n" << complex.to_string();
- if (complex.num_blockers() != 1) return false;
+ BOOST_CHECK(complex.num_vertices() == 4);
+ BOOST_CHECK(complex.num_blockers() == 1);
+ BOOST_CHECK(complex.num_edges() == 6);
Sh expected_blocker(Vh(1), Vh(2), Vh(3));
for (auto b : complex.const_blocker_range())
- if (*b != expected_blocker) return false;
- return complex.num_vertices() == 4 && complex.num_blockers() == 1 && complex.num_edges() == 6;
+ BOOST_CHECK(*b == expected_blocker);
}
-bool test_constructor7() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_constructor7) {
typedef Vertex_handle Vh;
typedef Simplex Sh;
std::vector<Simplex> simplices;
@@ -877,18 +804,19 @@ bool test_constructor7() {
simplices.push_back(Sh(Vh(3), Vh(0), Vh(1)));
//get complex from top faces
- Complex complex(make_complex_from_top_faces<Complex>(simplices.begin(), simplices.end()));
+ Complex complex(Gudhi::skeleton_blocker::make_complex_from_top_faces<Complex>(simplices.begin(), simplices.end()));
- DBGVALUE(complex.to_string());
+ std::cout << "Constructor 7:\n" << complex.to_string();
- if (complex.num_blockers() != 1) return false;
+ BOOST_CHECK(complex.num_vertices() == 4);
+ BOOST_CHECK(complex.num_blockers() == 1);
+ BOOST_CHECK(complex.num_edges() == 6);
Sh expected_blocker(Vh(0), Vh(1), Vh(2), Vh(3));
for (auto b : complex.const_blocker_range())
- if (*b != expected_blocker) return false;
- return complex.num_vertices() == 4 && complex.num_blockers() == 1 && complex.num_edges() == 6;
+ BOOST_CHECK(*b == expected_blocker);
}
-bool test_constructor8() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_complex_constructor8) {
typedef Vertex_handle Vh;
typedef Simplex Sh;
std::vector<Simplex> simplices;
@@ -899,54 +827,11 @@ bool test_constructor8() {
simplices.push_back(Sh(Vh(2), Vh(3)));
//get complex from top faces
- Complex complex(make_complex_from_top_faces<Complex>(simplices.begin(), simplices.end()));
-
- DBGVALUE(complex.to_string());
-
- return complex.num_vertices() == 4 && complex.num_blockers() == 2 && complex.num_edges() == 5;
-}
-
-int main(int argc, char *argv[]) {
- Tests tests_complex;
- tests_complex.add("test simplex", test_simplex);
- tests_complex.add("test_num_simplices", test_num_simplices);
- tests_complex.add("test_link0", test_link0);
- tests_complex.add("test_link1", test_link1);
- tests_complex.add("test_link2", test_link2);
- tests_complex.add("test_link3", test_link3);
- tests_complex.add("test_link4", test_link4);
- tests_complex.add("test_link5", test_link5);
- tests_complex.add("test_link6", test_link6);
- tests_complex.add("test_link7", test_link7);
-
- tests_complex.add("test_constructor_list_simplices", test_constructor);
- tests_complex.add("test_constructor_list_simplices2", test_constructor2);
- tests_complex.add("test_constructor_list_simplices3", test_constructor3);
- tests_complex.add("test_constructor_list_simplices4", test_constructor4);
- tests_complex.add("test_constructor_list_simplices5", test_constructor5);
- tests_complex.add("test_constructor_list_simplices6", test_constructor6);
- tests_complex.add("test_constructor_list_simplices7", test_constructor7);
- tests_complex.add("test_constructor_list_simplices8", test_constructor8);
-
- tests_complex.add("test iterator vertices 1", test_iterator_vertices1);
- tests_complex.add("test iterator vertices 2", test_iterator_vertices2);
- tests_complex.add("test iterator edges", test_iterator_edge);
- tests_complex.add("test iterator edges 2", test_iterator_edge2);
- tests_complex.add("test iterator edges 3", test_iterator_edge3);
- tests_complex.add("test iterator blockers", test_iterator_blockers);
- tests_complex.add("test_iterator_triangles", test_iterator_triangles);
- tests_complex.add("test iterator simplices", test_iterator_simplices);
- tests_complex.add("test iterator simplices2", test_iterator_simplices2);
- tests_complex.add("test iterator simplices3", test_iterator_simplices3);
- tests_complex.add("test iterator simplices4", test_iterator_simplices4);
- tests_complex.add("test iterator coboundary", test_iterator_coboundary);
-
- if (tests_complex.run()) {
- return EXIT_SUCCESS;
- } else {
- return EXIT_FAILURE;
- }
+ Complex complex(Gudhi::skeleton_blocker::make_complex_from_top_faces<Complex>(simplices.begin(), simplices.end()));
- // test_iterator_simplices();
-}
+ std::cout << "Constructor 8:\n" << complex.to_string();
+ BOOST_CHECK(complex.num_vertices() == 4);
+ BOOST_CHECK(complex.num_blockers() == 2);
+ BOOST_CHECK(complex.num_edges() == 5);
+}
diff --git a/src/Skeleton_blocker/test/test_skeleton_blocker_geometric_complex.cpp b/src/Skeleton_blocker/test/test_skeleton_blocker_geometric_complex.cpp
new file mode 100644
index 00000000..d035b2c3
--- /dev/null
+++ b/src/Skeleton_blocker/test/test_skeleton_blocker_geometric_complex.cpp
@@ -0,0 +1,125 @@
+/* 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
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string>
+#include <fstream>
+#include <sstream>
+
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE "skeleton_blocker_geometric_complex"
+#include <boost/test/unit_test.hpp>
+#include <boost/mpl/list.hpp>
+
+#include <gudhi/Skeleton_blocker.h>
+
+struct Geometry_trait {
+ typedef std::vector<double> Point;
+};
+
+typedef Geometry_trait::Point Point;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits<Geometry_trait> Complex_geometric_traits;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex< Complex_geometric_traits > Complex;
+typedef Complex::Vertex_handle Vertex_handle;
+typedef Complex_geometric_traits::Root_vertex_handle Root_vertex_handle;
+
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_off_reader_writer) {
+ Complex complex;
+ Gudhi::skeleton_blocker::Skeleton_blocker_off_reader<Complex> off_reader("test2.off", complex);
+ BOOST_CHECK(off_reader.is_valid());
+
+ std::cout << "complex has " <<
+ complex.num_vertices() << " vertices, " <<
+ complex.num_blockers() << " blockers, " <<
+ complex.num_edges() << " edges and " <<
+ complex.num_triangles() << " triangles.";
+
+ BOOST_CHECK(complex.num_vertices() == 7);
+ BOOST_CHECK(complex.num_edges() == 12);
+ BOOST_CHECK(complex.num_triangles() == 6);
+
+ Gudhi::skeleton_blocker::Skeleton_blocker_off_writer<Complex> off_writer("tmp.off", complex);
+ Complex same;
+ Gudhi::skeleton_blocker::Skeleton_blocker_off_reader<Complex> off_reader2("tmp.off", same);
+
+ std::cout << "\ncomplex:" << complex.to_string() << std::endl;
+ std::cout << "\nsame:" << same.to_string() << std::endl;
+
+ BOOST_CHECK(complex == same);
+}
+
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_abstract_link) {
+ Complex complex;
+ Gudhi::skeleton_blocker::Skeleton_blocker_off_reader<Complex> off_reader("test2.off", complex);
+ BOOST_CHECK(off_reader.is_valid());
+
+ std::cout << "complex has " <<
+ complex.num_vertices() << " vertices, " <<
+ complex.num_blockers() << " blockers, " <<
+ complex.num_edges() << " edges and " <<
+ complex.num_triangles() << " triangles.";
+
+ BOOST_CHECK(complex.num_vertices() == 7);
+ BOOST_CHECK(complex.num_edges() == 12);
+ BOOST_CHECK(complex.num_triangles() == 6);
+
+ auto link_0 = complex.abstract_link(Vertex_handle(0));
+
+ std::cout << "\n link(0):" << link_0.to_string() << std::endl;
+
+ BOOST_CHECK(link_0.num_vertices() == 2);
+ BOOST_CHECK(link_0.num_edges() == 1);
+ BOOST_CHECK(link_0.num_blockers() == 0);
+
+ // Check the 2 link vertices
+ auto vertex_handle = link_0.vertex_range().begin();
+ BOOST_CHECK(link_0[*vertex_handle].get_id() == Root_vertex_handle(1));
+ vertex_handle++;
+ BOOST_CHECK(link_0[*(vertex_handle)].get_id() == Root_vertex_handle(4));
+
+ // Check the lonely link edge
+ auto edge_handle = link_0.edge_range().begin();
+ BOOST_CHECK(link_0[*edge_handle].first() == Root_vertex_handle(1));
+ BOOST_CHECK(link_0[*(edge_handle)].second() == Root_vertex_handle(4));
+
+ auto link_geometric_0 = complex.link(Vertex_handle(0));
+ std::cout << "\n link_geometric(0):" << link_geometric_0.to_string() << std::endl;
+
+ BOOST_CHECK(link_0 == link_geometric_0);
+
+ auto print_point = [&](Vertex_handle v) {
+ for (auto x : link_geometric_0.point(v)) std::cout << x << " ";
+ std::cout << std::endl;
+ };
+
+ std::for_each(link_geometric_0.vertex_range().begin(), link_geometric_0.vertex_range().end(), print_point);
+
+ // Check the 2 link vertices
+ vertex_handle = link_geometric_0.vertex_range().begin();
+ std::vector<double> point_1 = {0,2,0};
+ std::vector<double> point_4 = {-1,1,0};
+ BOOST_CHECK(link_geometric_0.point(*vertex_handle) == point_1);
+ vertex_handle++;
+ BOOST_CHECK(link_geometric_0.point(*vertex_handle) == point_4);
+
+}
diff --git a/src/Skeleton_blocker/test/TestSimplifiable.cpp b/src/Skeleton_blocker/test/test_skeleton_blocker_simplifiable.cpp
index b0855ce9..360b91db 100644
--- a/src/Skeleton_blocker/test/TestSimplifiable.cpp
+++ b/src/Skeleton_blocker/test/test_skeleton_blocker_simplifiable.cpp
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* 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
@@ -20,44 +20,26 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <fstream>
#include <sstream>
-#include "gudhi/Test.h"
-//#include "Skeleton_blocker/Simplex.h"
-#include "gudhi/Skeleton_blocker.h"
-
-
-using namespace std;
-using namespace Gudhi;
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE "skeleton_blocker_simplifiable"
+#include <boost/test/unit_test.hpp>
+#include <boost/mpl/list.hpp>
-using namespace skbl;
+#include <gudhi/Skeleton_blocker.h>
template<typename ComplexType> class Skeleton_blocker_sub_complex;
-typedef Skeleton_blocker_complex<Skeleton_blocker_simple_traits> Complex;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_simple_traits Traits;
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_complex<Traits> Complex;
typedef Complex::Vertex_handle Vertex_handle;
typedef Complex::Root_vertex_handle Root_vertex_handle;
-typedef Skeleton_blocker_simplex<Vertex_handle> Simplex;
-// true iff v \in complex
-
-bool assert_vertex(Complex &complex, Vertex_handle v) {
- Simplex simplex(v);
- bool test = complex.contains(simplex);
- assert(test);
- return test;
-}
-
-// true iff the blocker (a,b,c) is in complex
-
-bool assert_blocker(Complex &complex, Root_vertex_handle a, Root_vertex_handle b, Root_vertex_handle c) {
+typedef Gudhi::skeleton_blocker::Skeleton_blocker_simplex<Vertex_handle> Simplex;
- return complex.contains_blocker(Simplex(*complex.get_address(a), *complex.get_address(b), *complex.get_address(c)));
- //return complex.contains_blocker((a),(b),(c));
-}
void build_complete(int n, Complex& complex) {
complex.clear();
@@ -68,11 +50,8 @@ void build_complete(int n, Complex& complex) {
complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(j));
}
-bool test_contraction1() {
-
- enum {
- a, b, x, y, z, n
- };
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_contraction1) {
+ enum { a, b, x, y, z, n };
Complex complex(n);
build_complete(n, complex);
complex.remove_edge(static_cast<Vertex_handle> (b), static_cast<Vertex_handle> (z));
@@ -82,35 +61,35 @@ bool test_contraction1() {
static_cast<Vertex_handle> (y)));
// Print result
- cerr << "complex before complex" << complex.to_string() << endl;
+ std::cout << "complex before complex" << complex.to_string() << std::endl;
- cerr << endl << endl;
+ std::cout << std::endl << std::endl;
complex.contract_edge(static_cast<Vertex_handle> (a), static_cast<Vertex_handle> (b));
// Print result
- cerr << "ContractEdge(0,1)\n";
+ std::cout << "ContractEdge(0,1)\n";
PRINT(complex.to_string());
// verification
for (int i = 0; i < 5; i++)
- if (i != 1) assert_vertex(complex, static_cast<Vertex_handle> (i));
- bool test1 = !complex.contains_edge(static_cast<Vertex_handle> (a), static_cast<Vertex_handle> (b));
- bool test2 = assert_blocker(complex, Root_vertex_handle(a), Root_vertex_handle(x), Root_vertex_handle(y));
- bool test3 = complex.num_edges() == 6;
- bool test4 = complex.num_blockers() == 1;
+ if (i != 1) BOOST_CHECK(complex.contains(Simplex(static_cast<Vertex_handle> (i))));
+ BOOST_CHECK(!complex.contains_edge(static_cast<Vertex_handle> (a), static_cast<Vertex_handle> (b)));
+
+ BOOST_CHECK(complex.contains_blocker(Simplex(*complex.get_address(Root_vertex_handle(a)),
+ *complex.get_address(Root_vertex_handle(x)),
+ *complex.get_address(Root_vertex_handle(y)))));
+
+ BOOST_CHECK(complex.num_edges() == 6);
+ BOOST_CHECK(complex.num_blockers() == 1);
Simplex sigma;
sigma.add_vertex(static_cast<Vertex_handle> (a));
sigma.add_vertex(static_cast<Vertex_handle> (x));
sigma.add_vertex(static_cast<Vertex_handle> (y));
sigma.add_vertex(static_cast<Vertex_handle> (z));
- bool test5 = !(complex.contains(sigma));
- return test1 && test2 && test3 && test4&&test5;
+ BOOST_CHECK(!(complex.contains(sigma)));
}
-bool test_contraction2() {
-
- enum {
- a, b, x, y, z, n
- };
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_contraction2) {
+ enum { a, b, x, y, z, n };
Complex complex(n);
build_complete(n, complex);
complex.remove_edge(static_cast<Vertex_handle> (b), static_cast<Vertex_handle> (x));
@@ -122,83 +101,73 @@ bool test_contraction2() {
complex.add_blocker(blocker);
// Print result
- cerr << "complex complex" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "complex complex" << complex.to_string();
+ std::cout << std::endl << std::endl;
complex.contract_edge(static_cast<Vertex_handle> (a), static_cast<Vertex_handle> (b));
- cerr << "complex.ContractEdge(a,b)" << complex.to_string();
+ std::cout << "complex.ContractEdge(a,b)" << complex.to_string();
- cerr << endl << endl;
+ std::cout << std::endl << std::endl;
// there should be one blocker (a,c,d,e) in the complex
- bool test;
- test = complex.contains_blocker(Simplex(static_cast<Vertex_handle> (a), static_cast<Vertex_handle> (x),
- static_cast<Vertex_handle> (y), static_cast<Vertex_handle> (z)));
- test = test && complex.num_blockers() == 1;
- return test;
+ BOOST_CHECK(complex.contains_blocker(Simplex(static_cast<Vertex_handle> (a), static_cast<Vertex_handle> (x),
+ static_cast<Vertex_handle> (y), static_cast<Vertex_handle> (z))));
+ BOOST_CHECK(complex.num_blockers() == 1);
}
-bool test_link_condition1() {
-
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_link_condition1) {
Complex complex(0);
// Build the complexes
build_complete(4, complex);
complex.add_blocker(Simplex(static_cast<Vertex_handle> (0), static_cast<Vertex_handle> (1), static_cast<Vertex_handle> (2)));
-
// Print result
- cerr << "complex complex" << complex.to_string();
- cerr << endl << endl;
-
- bool weak_link_condition = complex.link_condition(Vertex_handle(1), Vertex_handle(2), true);
+ std::cout << "complex complex" << complex.to_string();
+ std::cout << std::endl << std::endl;
- bool strong_link_condition = complex.link_condition(Vertex_handle(1), Vertex_handle(2), false);
+ BOOST_CHECK(complex.link_condition(Vertex_handle(1), Vertex_handle(2), true));
- return weak_link_condition && !strong_link_condition;
+ BOOST_CHECK(!complex.link_condition(Vertex_handle(1), Vertex_handle(2), false));
}
-bool test_collapse0() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_collapse0) {
Complex complex(5);
build_complete(4, complex);
complex.add_vertex();
complex.add_edge_without_blockers(static_cast<Vertex_handle> (2), static_cast<Vertex_handle> (4));
complex.add_edge_without_blockers(static_cast<Vertex_handle> (3), static_cast<Vertex_handle> (4));
// Print result
- cerr << "initial complex :\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "initial complex :\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
Simplex simplex_123(static_cast<Vertex_handle> (1), static_cast<Vertex_handle> (2), static_cast<Vertex_handle> (3));
complex.remove_star(simplex_123);
- cerr << "complex.remove_star(1,2,3):\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "complex.remove_star(1,2,3):\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
// verification
- bool blocker123_here = complex.contains_blocker(simplex_123);
- cerr << "----> Ocomplex \n";
- return blocker123_here;
+ BOOST_CHECK(complex.contains_blocker(simplex_123));
}
-bool test_collapse1() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_collapse1) {
Complex complex(5);
build_complete(4, complex);
complex.add_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3)));
// Print result
- cerr << "initial complex :\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "initial complex :\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
Simplex simplex_123(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3));
complex.remove_star(simplex_123);
- cerr << "complex.remove_star(1,2,3):\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "complex.remove_star(1,2,3):\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
// verification
- bool res = complex.contains_blocker(simplex_123);
- res = res && complex.num_blockers() == 1;
- cerr << "----> Ocomplex \n";
- return res;
+ BOOST_CHECK(complex.contains_blocker(simplex_123));
+ BOOST_CHECK(complex.num_blockers() == 1);
}
-bool test_collapse2() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_collapse2) {
Complex complex(5);
build_complete(4, complex);
complex.add_vertex();
@@ -207,21 +176,21 @@ bool test_collapse2() {
complex.add_edge_without_blockers(Vertex_handle(3), Vertex_handle(4));
complex.add_blocker(Simplex(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3), Vertex_handle(4)));
// Print result
- cerr << "initial complex :\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "initial complex :\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
Simplex sigma(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3));
complex.remove_star(sigma);
- cerr << "complex.remove_star(1,2,3):\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "complex.remove_star(1,2,3):\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
// verification
- bool blocker_removed = !complex.contains_blocker(Simplex(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3), Vertex_handle(4)));
- bool blocker123_here = complex.contains_blocker(sigma);
- return blocker_removed && blocker123_here;
+ BOOST_CHECK(!complex.contains_blocker(Simplex(Vertex_handle(1), Vertex_handle(2),
+ Vertex_handle(3), Vertex_handle(4))));
+ BOOST_CHECK(complex.contains_blocker(sigma));
}
-bool test_collapse3() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_collapse3) {
Complex complex(5);
build_complete(4, complex);
complex.add_vertex();
@@ -230,36 +199,37 @@ bool test_collapse3() {
complex.add_edge_without_blockers(Vertex_handle(3), Vertex_handle(4));
complex.add_blocker(Simplex(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3), Vertex_handle(4)));
// Print result
- cerr << "initial complex:\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "initial complex:\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
complex.remove_star(static_cast<Vertex_handle> (2));
- cerr << "complex after remove star of 2:\n" << complex.to_string();
+ std::cout << "complex after remove star of 2:\n" << complex.to_string();
- bool blocker134_here = complex.contains_blocker(Simplex(Vertex_handle(1), Vertex_handle(3), Vertex_handle(4)));
- bool blocker1234_here = complex.contains_blocker(Simplex(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3), Vertex_handle(4)));
- return blocker134_here && !blocker1234_here;
+ BOOST_CHECK(complex.contains_blocker(Simplex(Vertex_handle(1), Vertex_handle(3), Vertex_handle(4))));
+ BOOST_CHECK(!complex.contains_blocker(Simplex(Vertex_handle(1), Vertex_handle(2),
+ Vertex_handle(3), Vertex_handle(4))));
}
-bool test_add_simplex() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_add_simplex) {
Complex complex(4);
build_complete(4, complex);
complex.add_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(3)));
- cerr << "initial complex:\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "initial complex:\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
complex.add_simplex(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(3)));
- cerr << "complex after add_simplex:\n" << complex.to_string();
- return complex.num_blockers() == 1
- && complex.contains_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3)));
+ std::cout << "complex after add_simplex:\n" << complex.to_string();
+ BOOST_CHECK(complex.num_blockers() == 1);
+ BOOST_CHECK(complex.contains_blocker(Simplex(Vertex_handle(0), Vertex_handle(1),
+ Vertex_handle(2), Vertex_handle(3))));
}
-bool test_add_simplex2() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_add_simplex2) {
Complex complex;
build_complete(4, complex);
// Print result
- cerr << "initial complex:\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "initial complex:\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
Complex copy(complex.num_vertices());
@@ -274,33 +244,33 @@ bool test_add_simplex2() {
copy.add_simplex(simplex);
}
+ std::cout << "complex after add_simplex:\n" << copy.to_string();
- cerr << "complex after add_simplex:\n" << copy.to_string();
-
-
- return complex.num_blockers() == copy.num_blockers() &&
- complex.num_edges() == copy.num_edges() &&
- complex.num_vertices() == copy.num_vertices();
+ BOOST_CHECK(complex.num_blockers() == copy.num_blockers());
+ BOOST_CHECK(complex.num_edges() == copy.num_edges());
+ BOOST_CHECK(complex.num_vertices() == copy.num_vertices());
}
-bool test_add_simplex3() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_add_simplex3) {
Complex complex(5);
build_complete(5, complex);
complex.remove_edge(Vertex_handle(3), Vertex_handle(4));
Simplex sigma(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2));
complex.add_blocker(sigma);
// Print result
- cerr << "initial complex:\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "initial complex:\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
complex.add_simplex(sigma);
//should create two blockers 0123 and 0124
- cerr << "complex after adding simplex 012:\n" << complex.to_string();
- return complex.num_blockers() == 2
- && complex.contains_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3)))
- && complex.contains_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(4)));
+ std::cout << "complex after adding simplex 012:\n" << complex.to_string();
+ BOOST_CHECK(complex.num_blockers() == 2);
+ BOOST_CHECK(complex.contains_blocker(Simplex(Vertex_handle(0), Vertex_handle(1),
+ Vertex_handle(2), Vertex_handle(3))));
+ BOOST_CHECK(complex.contains_blocker(Simplex(Vertex_handle(0), Vertex_handle(1),
+ Vertex_handle(2), Vertex_handle(4))));
}
-bool test_add_simplex4() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_add_simplex4) {
int n = 6;
Complex complex(n);
@@ -313,40 +283,38 @@ bool test_add_simplex4() {
complex.add_simplex(s);
//at step i there is only blocker 0..i
- if (i < 2 && complex.num_blockers() > 0)
- return false;
+ BOOST_CHECK(!(i < 2 && complex.num_blockers() > 0));
if (i >= 2 && complex.num_blockers() != 1) {
Simplex b;
for (int k = 0; k < i; k++)
b.add_vertex(Vertex_handle(i));
- if (!complex.contains_blocker(b))
- return false;
+ BOOST_CHECK(complex.contains_blocker(b));
}
- TESTVALUE(complex.blockers_to_string());
}
Simplex s;
for (int k = 0; k < n; k++)
s.add_vertex(Vertex_handle(k));
- return complex.num_blockers() == 1 && complex.contains_blocker(s);
+ BOOST_CHECK(complex.num_blockers() == 1);
+ BOOST_CHECK(complex.contains_blocker(s));
}
-bool test_add_edge() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_add_edge) {
Complex complex(4);
for (unsigned i = 0u; i < 4; i++)
complex.add_edge(Vertex_handle(i), Vertex_handle((i + 1) % 4));
// Print result
- cerr << "initial complex:\n" << complex.to_string();
- cerr << endl << endl;
+ std::cout << "initial complex:\n" << complex.to_string();
+ std::cout << std::endl << std::endl;
complex.add_edge(Vertex_handle(1), Vertex_handle(3));
//should create two blockers 013 and 012
- cerr << "complex after adding edge 13:\n" << complex.to_string();
- return complex.num_blockers() == 2
- && complex.contains_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(3)))
- && complex.contains_blocker(Simplex(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3)));
+ std::cout << "complex after adding edge 13:\n" << complex.to_string();
+ BOOST_CHECK(complex.num_blockers() == 2);
+ BOOST_CHECK(complex.contains_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(3))));
+ BOOST_CHECK(complex.contains_blocker(Simplex(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3))));
}
-bool test_remove_popable_blockers() {
+BOOST_AUTO_TEST_CASE(test_skeleton_blocker_simplifiable_remove_popable_blockers) {
Complex complex;
build_complete(4, complex);
complex.add_vertex();
@@ -357,15 +325,14 @@ bool test_remove_popable_blockers() {
complex.add_blocker(sigma1);
complex.add_blocker(sigma2);
- cerr << "complex complex" << complex.to_string();
- cerr << endl << endl;
- cerr << "complex.RemovePopableBlockers();" << endl;
+ std::cout << "complex complex" << complex.to_string();
+ std::cout << std::endl << std::endl;
+ std::cout << "complex.RemovePopableBlockers();" << std::endl;
complex.remove_popable_blockers();
- cerr << "complex complex" << complex.to_string();
- cerr << endl << endl;
-
- bool test1 = (complex.num_blockers() == 1);
+ std::cout << "complex complex" << complex.to_string();
+ std::cout << std::endl << std::endl;
+ BOOST_CHECK(complex.num_blockers() == 1);
// test 2
complex.clear();
@@ -382,41 +349,12 @@ bool test_remove_popable_blockers() {
complex.add_blocker(sigma1);
complex.add_blocker(sigma2);
- cerr << "complex complex" << complex.to_string();
- cerr << endl << endl;
- cerr << "complex.RemovePopableBlockers();" << endl;
+ std::cout << "complex complex" << complex.to_string();
+ std::cout << std::endl << std::endl;
+ std::cout << "complex.RemovePopableBlockers();" << std::endl;
complex.remove_popable_blockers();
- cerr << "complex complex" << complex.to_string();
-
- cerr << endl << endl;
- bool test2 = (complex.num_blockers() == 0);
- return test1&&test2;
-}
-
-int main(int argc, char *argv[]) {
- Tests tests_simplifiable_complex;
- tests_simplifiable_complex.add("Test contraction 1", test_contraction1);
- tests_simplifiable_complex.add("Test contraction 2", test_contraction2);
- tests_simplifiable_complex.add("Test Link condition 1", test_link_condition1);
- tests_simplifiable_complex.add("Test remove popable blockers", test_remove_popable_blockers);
-
-
- tests_simplifiable_complex.add("Test collapse 0", test_collapse0);
- tests_simplifiable_complex.add("Test collapse 1", test_collapse1);
- tests_simplifiable_complex.add("Test collapse 2", test_collapse2);
- tests_simplifiable_complex.add("Test collapse 3", test_collapse3);
-
- tests_simplifiable_complex.add("Test add edge",test_add_edge);
- tests_simplifiable_complex.add("Test add simplex", test_add_simplex);
- tests_simplifiable_complex.add("Test add simplex2", test_add_simplex2);
- tests_simplifiable_complex.add("Test add simplex3",test_add_simplex3);
- tests_simplifiable_complex.add("Test add simplex4",test_add_simplex4);
-
-
- tests_simplifiable_complex.run();
+ std::cout << "complex complex" << complex.to_string();
- if (tests_simplifiable_complex.run())
- return EXIT_SUCCESS;
- else
- return EXIT_FAILURE;
+ std::cout << std::endl << std::endl;
+ BOOST_CHECK(complex.num_blockers() == 0);
}
diff --git a/src/Witness_complex/example/CMakeLists.txt b/src/Witness_complex/example/CMakeLists.txt
index b304479e..4d67e0d0 100644
--- a/src/Witness_complex/example/CMakeLists.txt
+++ b/src/Witness_complex/example/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIWitnessComplex)
+project(Witness_complex_examples)
# A simple example
add_executable( witness_complex_from_file witness_complex_from_file.cpp )
@@ -7,38 +7,10 @@ project(GUDHIWitnessComplex)
if(CGAL_FOUND)
if (NOT CGAL_VERSION VERSION_LESS 4.6.0)
- message(STATUS "CGAL version: ${CGAL_VERSION}.")
-
- include( ${CGAL_USE_FILE} )
- # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten.
- # cf. http://doc.cgal.org/latest/Manual/installation.html#title40
- # A workaround is to add "-std=c++11" again.
- # A fix would be to use https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
- # or even better https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD.html
- # but it implies to use cmake version 3.1 at least.
- if(NOT MSVC)
- include(CheckCXXCompilerFlag)
- CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
- if(COMPILER_SUPPORTS_CXX11)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
- endif()
- endif()
- # - End of workaround
-
- find_package(Eigen3 3.1.0)
if (EIGEN3_FOUND)
- message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
- include( ${EIGEN3_USE_FILE} )
- message(STATUS "Eigen3 use file: ${EIGEN3_USE_FILE}.")
- include_directories (BEFORE "../../include")
-
add_executable ( witness_complex_sphere witness_complex_sphere.cpp )
target_link_libraries(witness_complex_sphere ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
add_test( witness_complex_sphere_10 ${CMAKE_CURRENT_BINARY_DIR}/witness_complex_sphere 10)
- else()
- message(WARNING "Eigen3 not found. Version 3.1.0 is required for witness_complex_sphere example.")
- endif()
- else()
- message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile witness_complex_sphere example. Version 4.6.0 is required.")
- endif ()
+ endif(EIGEN3_FOUND)
+ endif (NOT CGAL_VERSION VERSION_LESS 4.6.0)
endif()
diff --git a/src/Witness_complex/test/CMakeLists.txt b/src/Witness_complex/test/CMakeLists.txt
index 37bef2d0..bb55b0f1 100644
--- a/src/Witness_complex/test/CMakeLists.txt
+++ b/src/Witness_complex/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIWitnessComplexUT)
+project(Witness_complex_tests)
if (GCOVR_PATH)
# for gcovr to make coverage reports - Corbera Jenkins plugin
diff --git a/src/cmake/modules/FindQGLViewer.cmake b/src/cmake/modules/FindQGLViewer.cmake
index 65723d67..1f3dbc1f 100644
--- a/src/cmake/modules/FindQGLViewer.cmake
+++ b/src/cmake/modules/FindQGLViewer.cmake
@@ -15,7 +15,7 @@ find_path(QGLVIEWER_INCLUDE_DIR
)
find_library(QGLVIEWER_LIBRARY_RELEASE
- NAMES qglviewer-qt4 qglviewer QGLViewer QGLViewer2
+ NAMES qglviewer-qt4 QGLViewer-qt4 qglviewer QGLViewer QGLViewer2
PATHS /usr/lib
/usr/local/lib
ENV QGLVIEWERROOT
diff --git a/src/cmake/modules/GUDHI_doxygen_target.txt b/src/cmake/modules/GUDHI_doxygen_target.txt
new file mode 100644
index 00000000..d2cb952d
--- /dev/null
+++ b/src/cmake/modules/GUDHI_doxygen_target.txt
@@ -0,0 +1,11 @@
+# add a target to generate API documentation with Doxygen
+find_package(Doxygen)
+if(DOXYGEN_FOUND)
+ # configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
+
+ add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${GUDHI_USER_VERSION_DIR}/Doxyfile
+ WORKING_DIRECTORY ${GUDHI_USER_VERSION_DIR}
+ DEPENDS ${GUDHI_USER_VERSION_DIR}/Doxyfile ${GUDHI_DOXYGEN_DEPENDENCY}
+ COMMENT "Generating API documentation with Doxygen in ${GUDHI_USER_VERSION_DIR}/doc/html/" VERBATIM)
+
+endif(DOXYGEN_FOUND)
diff --git a/src/cmake/modules/GUDHI_user_version_target.txt b/src/cmake/modules/GUDHI_user_version_target.txt
new file mode 100644
index 00000000..805f0a83
--- /dev/null
+++ b/src/cmake/modules/GUDHI_user_version_target.txt
@@ -0,0 +1,115 @@
+# Some functionnalities requires CMake 2.8.11 minimum
+if (NOT CMAKE_VERSION VERSION_LESS 2.8.11)
+
+ string(TIMESTAMP DATE_AND_TIME "%Y-%m-%d-%H-%M-%S")
+
+ # Definition of the custom target user_version
+ add_custom_target(user_version)
+
+ if(DEFINED USER_VERSION_DIR)
+ # set the GUDHI_USER_VERSION_DIR with USER_VERSION_DIR defined by the user
+ set(GUDHI_USER_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/${USER_VERSION_DIR})
+ else()
+ # set the GUDHI_USER_VERSION_DIR with timestamp and Gudhi version number
+ set(GUDHI_USER_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/${DATE_AND_TIME}_GUDHI_${GUDHI_VERSION})
+ endif()
+
+ set(GUDHI_DOXYGEN_DEPENDENCY user_version)
+
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ make_directory ${GUDHI_USER_VERSION_DIR}
+ COMMENT "user_version creation in ${GUDHI_USER_VERSION_DIR}")
+
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/README ${GUDHI_USER_VERSION_DIR}/README)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/COPYING ${GUDHI_USER_VERSION_DIR}/COPYING)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/src/CMakeLists.txt ${GUDHI_USER_VERSION_DIR}/CMakeLists.txt)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/src/Doxyfile ${GUDHI_USER_VERSION_DIR}/Doxyfile)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/src/GUDHIConfigVersion.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIConfigVersion.cmake.in)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/src/GUDHIConfig.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIConfig.cmake.in)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/CMakeGUDHIVersion.txt ${GUDHI_USER_VERSION_DIR}/CMakeGUDHIVersion.txt)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/GUDHIVersion.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIVersion.cmake.in)
+
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/biblio ${GUDHI_USER_VERSION_DIR}/biblio)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/data ${GUDHI_USER_VERSION_DIR}/data)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/src/cmake ${GUDHI_USER_VERSION_DIR}/cmake)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/src/debian ${GUDHI_USER_VERSION_DIR}/debian)
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/src/GudhUI ${GUDHI_USER_VERSION_DIR}/GudhUI)
+
+ set(GUDHI_MODULES "common;Alpha_complex;Bitmap_cubical_complex;Contraction;Hasse_complex;Persistent_cohomology;Simplex_tree;Skeleton_blocker;Witness_complex")
+
+ foreach(GUDHI_MODULE ${GUDHI_MODULES})
+ # doc files
+ file(GLOB GUDHI_DOC_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/doc/*)
+
+ foreach(GUDHI_DOC_FILE ${GUDHI_DOC_FILES})
+ get_filename_component(GUDHI_DOC_FILE_NAME ${GUDHI_DOC_FILE} NAME)
+ # GUDHI_DOC_FILE can be a file or a directory
+ if(IS_DIRECTORY ${GUDHI_DOC_FILE})
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${GUDHI_DOC_FILE} ${GUDHI_USER_VERSION_DIR}/doc/${GUDHI_MODULE}/${GUDHI_DOC_FILE_NAME})
+ else()
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${GUDHI_DOC_FILE} ${GUDHI_USER_VERSION_DIR}/doc/${GUDHI_MODULE}/${GUDHI_DOC_FILE_NAME})
+ endif()
+ endforeach()
+
+ # example files
+ file(GLOB GUDHI_EXAMPLE_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/example/*)
+
+ foreach(GUDHI_EXAMPLE_FILE ${GUDHI_EXAMPLE_FILES})
+ get_filename_component(GUDHI_EXAMPLE_FILE_NAME ${GUDHI_EXAMPLE_FILE} NAME)
+ # GUDHI_EXAMPLE_FILE can be a file or a directory
+ if(IS_DIRECTORY ${GUDHI_EXAMPLE_FILE})
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${GUDHI_EXAMPLE_FILE} ${GUDHI_USER_VERSION_DIR}/example/${GUDHI_MODULE}/${GUDHI_EXAMPLE_FILE_NAME})
+ else()
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${GUDHI_EXAMPLE_FILE} ${GUDHI_USER_VERSION_DIR}/example/${GUDHI_MODULE}/${GUDHI_EXAMPLE_FILE_NAME})
+ endif()
+ endforeach()
+
+ # include files
+ file(GLOB GUDHI_INCLUDE_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/include/gudhi/*)
+
+ foreach(GUDHI_INCLUDE_FILE ${GUDHI_INCLUDE_FILES})
+ get_filename_component(GUDHI_INCLUDE_FILE_NAME ${GUDHI_INCLUDE_FILE} NAME)
+ # GUDHI_INCLUDE_FILE can be a file or a directory
+ if(IS_DIRECTORY ${GUDHI_INCLUDE_FILE})
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${GUDHI_INCLUDE_FILE} ${GUDHI_USER_VERSION_DIR}/include/gudhi/${GUDHI_INCLUDE_FILE_NAME})
+ else()
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${GUDHI_INCLUDE_FILE} ${GUDHI_USER_VERSION_DIR}/include/gudhi/${GUDHI_INCLUDE_FILE_NAME})
+ endif()
+ endforeach()
+
+ # concept files
+ file(GLOB GUDHI_CONCEPT_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/concept/*.h)
+
+ foreach(GUDHI_CONCEPT_FILE ${GUDHI_CONCEPT_FILES})
+ get_filename_component(GUDHI_CONCEPT_FILE_NAME ${GUDHI_CONCEPT_FILE} NAME)
+ # GUDHI_CONCEPT_FILE can be a file or a directory
+ if(IS_DIRECTORY ${GUDHI_CONCEPT_FILE})
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${GUDHI_CONCEPT_FILE} ${GUDHI_USER_VERSION_DIR}/concept/${GUDHI_MODULE}/${GUDHI_CONCEPT_FILE_NAME})
+ else()
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${GUDHI_CONCEPT_FILE} ${GUDHI_USER_VERSION_DIR}/concept/${GUDHI_MODULE}/${GUDHI_CONCEPT_FILE_NAME})
+ endif()
+ endforeach()
+ endforeach()
+
+endif()
diff --git a/src/common/doc/header.html b/src/common/doc/header.html
index c958390c..a6f3ed9c 100644
--- a/src/common/doc/header.html
+++ b/src/common/doc/header.html
@@ -40,6 +40,7 @@ $extrastylesheet
<li><a href="http://gudhi.gforge.inria.fr/getinvolved/">Get involved</a></li>
<li><a href="http://gudhi.gforge.inria.fr/partners/">Partners and Funding</a></li>
<li><a href="http://gudhi.gforge.inria.fr/relatedprojects/">Related projects</a></li>
+ <li><a href="http://gudhi.gforge.inria.fr/theyaretalkingaboutus/">They are talking about us</a></li>
</ul>
</li>
<li class="divider"></li>
@@ -52,7 +53,7 @@ $extrastylesheet
</ul>
</li>
<li class="divider"></li>
- <li><a href="http://gudhi.gforge.inria.fr/doc/latest/modules.html">Documentation</a></li>
+ <li><a href="http://gudhi.gforge.inria.fr/doc/latest/">Documentation</a></li>
<li class="divider"></li>
<li><a href="http://gudhi.gforge.inria.fr/interfaces/">Interfaces</a></li>
<li class="divider"></li>
diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h
index abe7398b..21cf6925 100644
--- a/src/common/doc/main_page.h
+++ b/src/common/doc/main_page.h
@@ -13,8 +13,8 @@
* The current release of the GUDHI library includes:
*
* \li Data structures to represent, construct and manipulate simplicial complexes.
- * \li Algorithms to compute persistent homology and multi-field persistent homology.
- * \li Simplication of simplicial complexes by edge contraction.
+ * \li Simplification of simplicial complexes by edge contraction.
+ * \li Algorithms to compute persistent homology persistent homology.
*
* All data-structures are generic and several of their aspects can be parameterized via template classes.
* We refer to \cite gudhilibrary_ICMS14 for a detailed description of the design of the library.
@@ -36,7 +36,7 @@
values of the codimension 1 cofaces that make it not Gabriel otherwise.
All simplices that have a filtration value strictly greater than a given alpha squared value are not inserted into
the complex.<br>
- <b>User manual:</b> \ref alpha_complex - <b>Reference manual:</b> Gudhi::alphacomplex::Alpha_complex
+ <b>User manual:</b> \ref alpha_complex - <b>Reference manual:</b> Gudhi::alpha_complex::Alpha_complex
</td>
</tr>
</table>
@@ -52,7 +52,7 @@
<td width="75%">
The cubical complex is an example of a structured complex useful in computational mathematics (specially
rigorous numerics) and image analysis.<br>
- <b>User manual:</b> \ref cubical_complex - <b>Reference manual:</b> Gudhi::Cubical_complex::Bitmap_cubical_complex
+ <b>User manual:</b> \ref cubical_complex - <b>Reference manual:</b> Gudhi::cubical_complex::Bitmap_cubical_complex
</td>
</tr>
</table>
@@ -89,7 +89,7 @@
This data-structure handles all simplicial complexes operations such as simplex enumeration or simplex removal but
operations that are particularly efficient are operations that do not require simplex enumeration such as edge
iteration, link computation or simplex contraction.<br>
- <b>User manual:</b> \ref skbl - <b>Reference manual:</b> Gudhi::skbl::Skeleton_blocker_complex
+ <b>User manual:</b> \ref skbl - <b>Reference manual:</b> Gudhi::skeleton_blocker::Skeleton_blocker_complex
</td>
</tr>
</table>
@@ -154,6 +154,7 @@
*/
/*! \page installation Gudhi installation
+ * \tableofcontents
* As Gudhi is a header only library, there is no need to install the library.
*
* Examples of Gudhi headers inclusion can be found in \ref demos.
@@ -162,6 +163,20 @@
* The library uses c++11 and requires <a target="_blank" href="http://www.boost.org/">Boost</a> with version 1.48.0 or
* more recent. It is a multi-platform library and compiles on Linux, Mac OSX and Visual Studio 2015.
*
+ * \subsection demos Demos and examples
+ * To build the demos and examples, run the following commands in a terminal:
+\verbatim cd /path-to-gudhi/
+mkdir build
+cd build/
+cmake ..
+make \endverbatim
+ * A list of examples is available <a href="examples.html">here</a>.
+ *
+ * \subsection testsuites Test suites
+ * To test your build, run the following command in a terminal:
+ * \verbatim make test \endverbatim
+ *
+ * \section optionallibrary Optional third-party library
* \subsection gmp GMP:
* The multi-field persistent homology algorithm requires GMP which is a free library for arbitrary-precision
* arithmetic, operating on signed integers, rational numbers, and floating point numbers.
@@ -176,7 +191,8 @@
* Having GMP version 4.2 or higher installed is recommended.
*
* \subsection cgal CGAL:
- * CGAL is a C++ library which provides easy access to efficient and reliable geometric algorithms.
+ * The \ref alpha_complex data structure and few examples requires CGAL, which is a C++ library which provides easy
+ * access to efficient and reliable geometric algorithms.
*
* Having CGAL version 4.4 or higher installed is recommended. The procedure to install this library according to
* your operating system is detailed here http://doc.cgal.org/latest/Manual/installation.html
@@ -187,10 +203,6 @@
* Persistent_cohomology/alpha_complex_3d_persistence.cpp</a>
* \li <a href="_simplex_tree_2simplex_tree_from_alpha_shapes_3_8cpp-example.html">
* Simplex_tree/simplex_tree_from_alpha_shapes_3.cpp</a>
- * \li <a href="_alpha_complex_2_alpha_complex_from_off_8cpp-example.html">
- * Alpha_complex/Alpha_complex_from_off.cpp</a>
- * \li <a href="_alpha_complex_2_alpha_complex_from_points_8cpp-example.html">
- * Alpha_complex/Alpha_complex_from_points.cpp</a>
*
* The following example requires CGAL version &ge; 4.6:
* \li <a href="_witness_complex_2witness_complex_sphere_8cpp-example.html">
@@ -209,6 +221,7 @@
* Persistent_cohomology/custom_persistence_sort.cpp</a>
*
* \subsection eigen3 Eigen3:
+ * The \ref alpha_complex data structure and few examples requires
* <a target="_blank" href="http://eigen.tuxfamily.org/">Eigen3</a> is a C++ template library for linear algebra:
* matrices, vectors, numerical solvers, and related algorithms.
*
@@ -253,8 +266,10 @@
* Simplex_tree/simplex_tree_from_alpha_shapes_3.cpp</a>
* \li <a href="_simplex_tree_2simplex_tree_from_cliques_of_graph_8cpp-example.html">
* Simplex_tree/simplex_tree_from_cliques_of_graph.cpp</a>
- * \li <a href="_persistent_cohomology_2alpha_shapes_persistence_8cpp-example.html">
- * Persistent_cohomology/alpha_shapes_persistence.cpp</a>
+ * \li <a href="_persistent_cohomology_2alpha_complex_3d_persistence_8cpp-example.html">
+ * Persistent_cohomology/alpha_complex_3d_persistence.cpp</a>
+ * \li <a href="_persistent_cohomology_2alpha_complex_persistence_8cpp-example.html">
+ * Persistent_cohomology/alpha_complex_persistence.cpp</a>
* \li <a href="_persistent_cohomology_2rips_persistence_via_boundary_matrix_8cpp-example.html">
* Persistent_cohomology/rips_persistence_via_boundary_matrix.cpp</a>
* \li <a href="_persistent_cohomology_2performance_rips_persistence_8cpp-example.html">
@@ -274,19 +289,6 @@
* \li <a href="_persistent_cohomology_2custom_persistence_sort_8cpp-example.html">
* Persistent_cohomology/custom_persistence_sort.cpp</a>
*
- * \subsection demos Demos and examples
- * To build the demos and examples, run the following commands in a terminal:
-\verbatim cd /path-to-gudhi/
-mkdir build
-cd build/
-cmake ..
-make \endverbatim
- * A list of examples is available <a href="examples.html">here</a>.
- *
- * \subsection testsuites Test suites
- * To test your build, run the following command in a terminal:
- * \verbatim make test \endverbatim
- *
* \section Contributions Bug reports and contributions
* Please help us improving the quality of the GUDHI library. You may report bugs or suggestions to:
* \verbatim Contact: gudhi-users@lists.gforge.inria.fr \endverbatim
@@ -313,8 +315,8 @@ make \endverbatim
* @example Bitmap_cubical_complex/Bitmap_cubical_complex.cpp
* @example Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
* @example Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp
- * @example common/CGAL_3D_points_off_reader.cpp
- * @example common/CGAL_points_off_reader.cpp
+ * @example common/example_CGAL_3D_points_off_reader.cpp
+ * @example common/example_CGAL_points_off_reader.cpp
* @example Contraction/Garland_heckbert.cpp
* @example Contraction/Rips_contraction.cpp
* @example Persistent_cohomology/alpha_complex_3d_persistence.cpp
diff --git a/src/common/example/CMakeLists.txt b/src/common/example/CMakeLists.txt
index 83f874e1..b0c6d69a 100644
--- a/src/common/example/CMakeLists.txt
+++ b/src/common/example/CMakeLists.txt
@@ -1,26 +1,21 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIDelaunayTriangulationOffFileReadWrite)
+project(Common_examples)
+
+add_executable ( vector_double_off_reader example_vector_double_points_off_reader.cpp )
+target_link_libraries(vector_double_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+add_test(vector_double_off_reader ${CMAKE_CURRENT_BINARY_DIR}/vector_double_off_reader ${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off)
-# need CGAL 4.7
if(CGAL_FOUND)
- add_executable ( cgal3Doffreader CGAL_3D_points_off_reader.cpp )
- target_link_libraries(cgal3Doffreader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
- add_test(cgal3Doffreader ${CMAKE_CURRENT_BINARY_DIR}/cgal3Doffreader ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off)
+ add_executable ( cgal_3D_off_reader example_CGAL_3D_points_off_reader.cpp )
+ target_link_libraries(cgal_3D_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ add_test(cgal_3D_off_reader ${CMAKE_CURRENT_BINARY_DIR}/cgal_3D_off_reader ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off)
+ # need CGAL 4.7
if (NOT CGAL_VERSION VERSION_LESS 4.7.0)
- find_package(Eigen3 3.1.0)
if (EIGEN3_FOUND)
- message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
- include( ${EIGEN3_USE_FILE} )
-
- add_executable ( cgaloffreader CGAL_points_off_reader.cpp )
- target_link_libraries(cgaloffreader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
- add_test(cgaloffreader ${CMAKE_CURRENT_BINARY_DIR}/cgaloffreader ${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off)
-
- else()
- message(WARNING "Eigen3 not found. Version 3.1.0 is required for Alpha shapes feature.")
- endif()
- else()
- message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Alpha shapes feature. Version 4.6.0 is required.")
- endif ()
+ add_executable ( cgal_off_reader example_CGAL_points_off_reader.cpp )
+ target_link_libraries(cgal_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ add_test(cgal_off_reader ${CMAKE_CURRENT_BINARY_DIR}/cgal_off_reader ${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off)
+ endif(EIGEN3_FOUND)
+ endif (NOT CGAL_VERSION VERSION_LESS 4.7.0)
endif()
diff --git a/src/common/example/CGAL_3D_points_off_reader.cpp b/src/common/example/example_CGAL_3D_points_off_reader.cpp
index d48bb17d..d48bb17d 100644
--- a/src/common/example/CGAL_3D_points_off_reader.cpp
+++ b/src/common/example/example_CGAL_3D_points_off_reader.cpp
diff --git a/src/common/example/CGAL_points_off_reader.cpp b/src/common/example/example_CGAL_points_off_reader.cpp
index d1ca166d..4522174a 100644
--- a/src/common/example/CGAL_points_off_reader.cpp
+++ b/src/common/example/example_CGAL_points_off_reader.cpp
@@ -37,7 +37,7 @@ int main(int argc, char **argv) {
int n {0};
for (auto point : point_cloud) {
std::cout << "Point[" << n << "] = ";
- for (int i {0}; i < point.dimension(); i++)
+ for (std::size_t i {0}; i < point.size(); i++)
std::cout << point[i] << " ";
std::cout << "\n";
++n;
diff --git a/src/common/example/example_vector_double_points_off_reader.cpp b/src/common/example/example_vector_double_points_off_reader.cpp
new file mode 100644
index 00000000..8aecb26e
--- /dev/null
+++ b/src/common/example/example_vector_double_points_off_reader.cpp
@@ -0,0 +1,41 @@
+#include <gudhi/Points_off_io.h>
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+using Point_d = std::vector<double>;
+
+void usage(char * const progName) {
+ std::cerr << "Usage: " << progName << " inputFile.off" << std::endl;
+ exit(-1);
+}
+
+int main(int argc, char **argv) {
+ if (argc != 2) {
+ std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl;
+ usage(argv[0]);
+ }
+
+ std::string offInputFile(argv[1]);
+ // Read the OFF file (input file name given as parameter) and triangulate points
+ Gudhi::Points_off_reader<Point_d> off_reader(offInputFile);
+ // Check the read operation was correct
+ if (!off_reader.is_valid()) {
+ std::cerr << "Unable to read file " << offInputFile << std::endl;
+ usage(argv[0]);
+ }
+
+ // Retrieve the triangulation
+ std::vector<Point_d> point_cloud = off_reader.get_point_cloud();
+
+ int n {0};
+ for (auto point : point_cloud) {
+ std::cout << "Point[" << n << "] = ";
+ for (std::size_t i {0}; i < point.size(); i++)
+ std::cout << point[i] << " ";
+ std::cout << "\n";
+ ++n;
+ }
+ return 0;
+}
diff --git a/src/common/include/gudhi/Points_3D_off_io.h b/src/common/include/gudhi/Points_3D_off_io.h
index 2647f11e..b0d24998 100644
--- a/src/common/include/gudhi/Points_3D_off_io.h
+++ b/src/common/include/gudhi/Points_3D_off_io.h
@@ -132,12 +132,12 @@ class Points_3D_off_visitor_reader {
*
* @code template<class InputIterator > Point_3::Point_3(double x, double y, double z) @endcode
*
- * @section Example
+ * @section point3doffioexample Example
*
* This example loads points from an OFF file and builds a vector of CGAL points in dimension 3.
* Then, it is asked to display the points.
*
- * @include common/CGAL_3D_points_off_reader.cpp
+ * @include common/example_CGAL_3D_points_off_reader.cpp
*
* When launching:
*
diff --git a/src/common/include/gudhi/Points_off_io.h b/src/common/include/gudhi/Points_off_io.h
index 74b49386..29af8a8a 100644
--- a/src/common/include/gudhi/Points_off_io.h
+++ b/src/common/include/gudhi/Points_off_io.h
@@ -73,9 +73,8 @@ class Points_off_visitor_reader {
* @details
* Point_d must have a constructor with the following form:
*
- * @code template<class InputIterator > Point_d::Point_d(int d, InputIterator first, InputIterator last) @endcode
+ * @code template<class InputIterator > Point_d::Point_d(InputIterator first, InputIterator last) @endcode
*
- * where d is the point dimension.
*/
void point(const std::vector<double>& point) {
#ifdef DEBUG_TRACES
@@ -86,7 +85,7 @@ class Points_off_visitor_reader {
std::cout << std::endl;
#endif // DEBUG_TRACES
// Fill the point cloud
- point_cloud.push_back(Point_d(point.size(), point.begin(), point.end()));
+ point_cloud.push_back(Point_d(point.begin(), point.end()));
}
// Off_reader visitor maximal_face implementation - Only points are read
@@ -115,16 +114,16 @@ class Points_off_visitor_reader {
*
* where d is the point dimension.
*
- * \section Example
+ * \section pointoffioexample Example
*
- * This example loads points from an OFF file and builds a vector of CGAL points in dimension d.
+ * This example loads points from an OFF file and builds a vector of points (vector of double).
* Then, it is asked to display the points.
*
- * \include common/CGAL_points_off_reader.cpp
+ * \include common/example_vector_double_points_off_reader.cpp
*
* When launching:
*
- * \code $> ./cgaloffreader ../../data/points/alphacomplexdoc.off
+ * \code $> ./vector_double_off_reader ../../data/points/alphacomplexdoc.off
* \endcode
*
* the program output is:
diff --git a/src/common/include/gudhi/Test.h b/src/common/include/gudhi/Test.h
deleted file mode 100644
index 6024c822..00000000
--- a/src/common/include/gudhi/Test.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef TEST_H_
-#define TEST_H_
-
-#include <list>
-#include <string>
-#include <vector>
-#include <sstream>
-#include <iostream>
-
-
-#define TEST(a) std::cout << "TEST: " << (a) << std::endl
-#define TESTMSG(a, b) std::cout << "TEST: " << a << b << std::endl
-#define TESTVALUE(a) std::cout << "TEST: " << #a << ": " << a << std::endl
-
-/**
- * Class to perform test
- */
-
-class Test {
- private:
- std::string name;
- bool (*test)();
-
- std::string separation() const {
- return "+++++++++++++++++++++++++++++++++++++++++++++++++\n";
- }
-
- std::string print_between_plus(std::string& s) const {
- std::stringstream res;
- res << "+++++++++++++++++" << s << "+++++++++++++++++\n";
- return res.str();
- }
-
- public:
- Test(std::string name_, bool (*test_)()) {
- name = name_;
- test = test_;
- }
-
- bool run() {
- std::cout << print_between_plus(name);
- return test();
- }
-
- std::string getName() {
- return name;
- }
-};
-
-class Tests {
- private:
- std::list<Test> tests;
-
- public:
- void add(std::string name_, bool (*test_)()) {
- Test test(name_, test_);
- tests.push_back(test);
- }
-
- bool run() {
- bool tests_succesful(true);
- std::vector<bool> res;
- for (Test test : tests) {
- res.push_back(test.run());
- }
- std::cout << "\n\n results of tests : " << std::endl;
- int i = 0;
- for (Test t : tests) {
- std::cout << "Test " << i << " \"" << t.getName() << "\" --> ";
- if (res[i++]) {
- std::cout << "OK" << std::endl;
- } else {
- std::cout << "Fail" << std::endl;
- tests_succesful = false;
- break;
- }
- }
- return tests_succesful;
- }
-};
-
-#endif // TEST_H_
diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt
index 789546ae..7ccdb752 100644
--- a/src/common/test/CMakeLists.txt
+++ b/src/common/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHIDelaunayTriangulationOffFileReadWriteUT)
+project(Common_tests)
if (GCOVR_PATH)
# for gcovr to make coverage reports - Corbera Jenkins plugin
@@ -10,30 +10,15 @@ if (GPROF_PATH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif()
-# need CGAL 4.7
-if(CGAL_FOUND)
- if (NOT CGAL_VERSION VERSION_LESS 4.7.0)
- find_package(Eigen3 3.1.0)
- if (EIGEN3_FOUND)
- message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
- include( ${EIGEN3_USE_FILE} )
-
- add_executable ( poffreader_UT points_off_reader_unit_test.cpp )
- target_link_libraries(poffreader_UT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( poffreader_UT test_points_off_reader.cpp )
+target_link_libraries(poffreader_UT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
- # Do not forget to copy test files in current binary dir
- file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+# Do not forget to copy test files in current binary dir
+file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
- # Unitary tests
- add_test(poffreader_UT ${CMAKE_CURRENT_BINARY_DIR}/poffreader_UT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/poffreader_UT.xml --log_level=test_suite --report_level=no)
+# Unitary tests
+add_test(poffreader_UT ${CMAKE_CURRENT_BINARY_DIR}/poffreader_UT
+ # XML format for Jenkins xUnit plugin
+ --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/poffreader_UT.xml --log_level=test_suite --report_level=no)
- else()
- message(WARNING "Eigen3 not found. Version 3.1.0 is required for Alpha shapes feature.")
- endif()
- else()
- message(WARNING "CGAL version: ${CGAL_VERSION} is too old to compile Alpha shapes feature. Version 4.6.0 is required.")
- endif ()
-endif()
diff --git a/src/common/test/points_off_reader_unit_test.cpp b/src/common/test/test_points_off_reader.cpp
index 73e19cbc..b4f71182 100644
--- a/src/common/test/points_off_reader_unit_test.cpp
+++ b/src/common/test/test_points_off_reader.cpp
@@ -22,10 +22,6 @@
#include <gudhi/Points_off_io.h>
-// For CGAL points type in dimension d
-// cf. http://doc.cgal.org/latest/Kernel_d/classCGAL_1_1Point__d.html
-#include <CGAL/Epick_d.h>
-
#include <iostream>
#include <string>
#include <vector>
@@ -34,8 +30,7 @@
#define BOOST_TEST_MODULE "points_off_read_write"
#include <boost/test/unit_test.hpp>
-typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Kernel;
-typedef typename Kernel::Point_d Point_d;
+using Point_d = std::vector<double>;
BOOST_AUTO_TEST_CASE( points_doc_test )
{
@@ -50,19 +45,19 @@ BOOST_AUTO_TEST_CASE( points_doc_test )
std::vector<Point_d> expected_points;
std::vector<double> point = {1.0, 1.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {7.0, 0.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {4.0, 6.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {9.0, 6.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {0.0, 14.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {2.0, 19.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
point = {9.0, 17.0};
- expected_points.push_back(Point_d(2, point.begin(), point.end()));
+ expected_points.push_back(Point_d(point.begin(), point.end()));
BOOST_CHECK(point_cloud == expected_points);
}