summaryrefslogtreecommitdiff
path: root/src/Persistent_cohomology/example
diff options
context:
space:
mode:
authorcjamin <cjamin@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-06-10 18:32:40 +0000
committercjamin <cjamin@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-06-10 18:32:40 +0000
commit956403526264a5dc25f289940f066da5dabc7cf4 (patch)
tree777627a8c9dfc82ae9f20d16d567ee29c03e8f29 /src/Persistent_cohomology/example
parent75a8bf8132d2bade9ccc31147db00bf29eeb7589 (diff)
parent2ecd97ff50b01f864944443b3a2a8ea0220d9b10 (diff)
Rename namespaces according to convention
+ Missing Boost_THREAD_LIBRARY + Useless typename + Use TBB_LIBRARIES git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/fix_naming@1274 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 5c02ec481b62ef52b40d849e76e3d333e2ca4e7c
Diffstat (limited to 'src/Persistent_cohomology/example')
-rw-r--r--src/Persistent_cohomology/example/CMakeLists.txt24
-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/periodic_alpha_complex_3d_persistence.cpp24
4 files changed, 32 insertions, 22 deletions
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt
index f85c50f9..a0af11c1 100644
--- a/src/Persistent_cohomology/example/CMakeLists.txt
+++ b/src/Persistent_cohomology/example/CMakeLists.txt
@@ -21,11 +21,11 @@ add_executable(persistence_from_file persistence_from_file.cpp)
target_link_libraries(persistence_from_file ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(plain_homology ${TBB_RELEASE_LIBRARY})
- target_link_libraries(persistence_from_simple_simplex_tree ${TBB_RELEASE_LIBRARY})
- target_link_libraries(rips_persistence ${TBB_RELEASE_LIBRARY})
- target_link_libraries(rips_persistence_via_boundary_matrix ${TBB_RELEASE_LIBRARY})
- target_link_libraries(persistence_from_file ${TBB_RELEASE_LIBRARY})
+ target_link_libraries(plain_homology ${TBB_LIBRARIES})
+ target_link_libraries(persistence_from_simple_simplex_tree ${TBB_LIBRARIES})
+ target_link_libraries(rips_persistence ${TBB_LIBRARIES})
+ target_link_libraries(rips_persistence_via_boundary_matrix ${TBB_LIBRARIES})
+ target_link_libraries(persistence_from_file ${TBB_LIBRARIES})
endif()
add_test(plain_homology ${CMAKE_CURRENT_BINARY_DIR}/plain_homology)
@@ -44,8 +44,8 @@ if(GMPXX_FOUND AND GMP_FOUND)
add_executable ( performance_rips_persistence performance_rips_persistence.cpp )
target_link_libraries(performance_rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
if (TBB_FOUND)
- target_link_libraries(rips_multifield_persistence ${TBB_RELEASE_LIBRARY})
- target_link_libraries(performance_rips_persistence ${TBB_RELEASE_LIBRARY})
+ target_link_libraries(rips_multifield_persistence ${TBB_LIBRARIES})
+ target_link_libraries(performance_rips_persistence ${TBB_LIBRARIES})
endif()
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)
@@ -55,7 +55,7 @@ if(GMPXX_FOUND AND GMP_FOUND)
target_link_libraries(alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES} ${CGAL_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(alpha_complex_3d_persistence ${TBB_RELEASE_LIBRARY})
+ target_link_libraries(alpha_complex_3d_persistence ${TBB_LIBRARIES})
endif()
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)
@@ -78,12 +78,12 @@ if(GMPXX_FOUND AND GMP_FOUND)
target_link_libraries(custom_persistence_sort ${Boost_SYSTEM_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES} ${CGAL_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(alpha_complex_persistence ${TBB_RELEASE_LIBRARY})
- target_link_libraries(periodic_alpha_complex_3d_persistence ${TBB_RELEASE_LIBRARY})
- target_link_libraries(custom_persistence_sort ${TBB_RELEASE_LIBRARY})
+ 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()
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 2 0)
+ 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()
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/periodic_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp
index b8e1097d..a199fea1 100644
--- a/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp
+++ b/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp
@@ -125,28 +125,28 @@ Vertex_list from(const Alpha_shape_3::Vertex_handle& vh) {
void usage(char * const progName) {
std::cerr << "Usage: " << progName <<
- " path_to_file_graph coeff_field_characteristic[integer > 0] min_persistence[float >= -1.0]\n";
+ " path_to_file_graph path_to_iso_cuboid_3_file coeff_field_characteristic[integer > 0] min_persistence[float >= -1.0]\n";
exit(-1);
}
int main(int argc, char * const argv[]) {
// program args management
- if (argc != 4) {
+ if (argc != 5) {
std::cerr << "Error: Number of arguments (" << argc << ") is not correct\n";
usage(argv[0]);
}
int coeff_field_characteristic = 0;
- int returnedScanValue = sscanf(argv[2], "%d", &coeff_field_characteristic);
+ int returnedScanValue = sscanf(argv[3], "%d", &coeff_field_characteristic);
if ((returnedScanValue == EOF) || (coeff_field_characteristic <= 0)) {
- std::cerr << "Error: " << argv[2] << " is not correct\n";
+ std::cerr << "Error: " << argv[3] << " is not correct\n";
usage(argv[0]);
}
Filtration_value min_persistence = 0.0;
- returnedScanValue = sscanf(argv[3], "%lf", &min_persistence);
+ returnedScanValue = sscanf(argv[4], "%lf", &min_persistence);
if ((returnedScanValue == EOF) || (min_persistence < -1.0)) {
- std::cerr << "Error: " << argv[3] << " is not correct\n";
+ std::cerr << "Error: " << argv[4] << " is not correct\n";
usage(argv[0]);
}
@@ -160,11 +160,21 @@ int main(int argc, char * const argv[]) {
usage(argv[0]);
}
+ // Read iso_cuboid_3 information from file
+ std::ifstream iso_cuboid_str(argv[2]);
+ double x_min, y_min, z_min, x_max, y_max, z_max;
+ if (iso_cuboid_str.good()) {
+ iso_cuboid_str >> x_min >> y_min >> z_min >> x_max >> y_max >> z_max;
+ } else {
+ std::cerr << "Unable to read file " << argv[2] << std::endl;
+ usage(argv[0]);
+ }
+
// Retrieve the triangulation
std::vector<Point_3> lp = off_reader.get_point_cloud();
// Define the periodic cube
- P3DT3 pdt(PK::Iso_cuboid_3(0, 0, 0, 1, 1, 1));
+ P3DT3 pdt(PK::Iso_cuboid_3(x_min, y_min, z_min, x_max, y_max, z_max));
// Heuristic for inserting large point sets (if pts is reasonably large)
pdt.insert(lp.begin(), lp.end(), true);
// As pdt won't be modified anymore switch to 1-sheeted cover if possible