From 75d981b8bc190420204c189f43fb6f6a744eb333 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 12 Mar 2019 13:50:23 +0100 Subject: Make 'safe' mode as default value for alpha complex 3d utility --- src/Alpha_complex/utilities/CMakeLists.txt | 8 ++++---- .../utilities/alpha_complex_3d_persistence.cpp | 24 +++++++++++----------- src/Alpha_complex/utilities/alphacomplex.md | 1 + 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/Alpha_complex/utilities/CMakeLists.txt b/src/Alpha_complex/utilities/CMakeLists.txt index b12c9690..e76edc5f 100644 --- a/src/Alpha_complex/utilities/CMakeLists.txt +++ b/src/Alpha_complex/utilities/CMakeLists.txt @@ -23,7 +23,7 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) add_test(NAME Alpha_complex_utilities_alpha_complex_3d COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" - "-p" "2" "-m" "0.45" "-o" "alpha.pers") + "-p" "2" "-m" "0.45" "-o" "safe.pers") add_test(NAME Alpha_complex_utilities_exact_alpha_complex_3d COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" @@ -31,13 +31,13 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) add_test(NAME Alpha_complex_utilities_safe_alpha_complex_3d COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" - "-p" "2" "-m" "0.45" "-o" "safe.pers" "-s") + "-p" "2" "-m" "0.45" "-o" "fast.pers" "-f") if (DIFF_PATH) add_test(Alpha_complex_utilities_diff_alpha_complex_3d ${DIFF_PATH} - "exact.pers" "alpha.pers") + "exact.pers" "safe.pers") add_test(Alpha_complex_utilities_diff_alpha_complex_3d ${DIFF_PATH} - "safe.pers" "alpha.pers") + "fast.pers" "safe.pers") endif() add_test(NAME Alpha_complex_utilities_periodic_alpha_complex_3d_persistence COMMAND $ diff --git a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp index 19e608ad..09c84eb3 100644 --- a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp +++ b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp @@ -94,11 +94,11 @@ int main(int argc, char **argv) { int coeff_field_characteristic = 0; Filtration_value min_persistence = 0.; bool exact_version = false; - bool safe_version = false; + bool fast_version = false; bool weighted_version = false; bool periodic_version = false; - program_options(argc, argv, off_file_points, exact_version, safe_version, weight_file, cuboid_file, output_file_diag, + program_options(argc, argv, off_file_points, exact_version, fast_version, weight_file, cuboid_file, output_file_diag, alpha_square_max_value, coeff_field_characteristic, min_persistence); std::vector weights; @@ -120,16 +120,16 @@ int main(int argc, char **argv) { periodic_version = true; } - Gudhi::alpha_complex::complexity complexity = Gudhi::alpha_complex::complexity::FAST; + Gudhi::alpha_complex::complexity complexity = Gudhi::alpha_complex::complexity::SAFE; if (exact_version) { - if (safe_version) { - std::cerr << "You cannot set the exact and the safe version." << std::endl; + if (fast_version) { + std::cerr << "You cannot set the exact and the fast version." << std::endl; exit(-1); } complexity = Gudhi::alpha_complex::complexity::EXACT; } - if (safe_version) { - complexity = Gudhi::alpha_complex::complexity::SAFE; + if (fast_version) { + complexity = Gudhi::alpha_complex::complexity::FAST; } Simplex_tree simplex_tree; @@ -258,7 +258,7 @@ int main(int argc, char **argv) { return 0; } -void program_options(int argc, char *argv[], std::string &off_file_points, bool &exact, bool &safe, +void program_options(int argc, char *argv[], std::string &off_file_points, bool &exact, bool &fast, std::string &weight_file, std::string &cuboid_file, std::string &output_file_diag, Filtration_value &alpha_square_max_value, int &coeff_field_characteristic, Filtration_value &min_persistence) { @@ -270,9 +270,9 @@ void program_options(int argc, char *argv[], std::string &off_file_points, bool po::options_description visible("Allowed options", 100); visible.add_options()("help,h", "produce help message")( "exact,e", po::bool_switch(&exact), - "To activate exact version of Alpha complex 3d (default is false, not available if safe is set)")( - "safe,s", po::bool_switch(&safe), - "To activate safe version of Alpha complex 3d (default is false, not available if exact is set)")( + "To activate exact version of Alpha complex 3d (default is false, not available if fast is set)")( + "fast,f", po::bool_switch(&fast), + "To activate fast version of Alpha complex 3d (default is false, not available if exact is set)")( "weight-file,w", po::value(&weight_file)->default_value(std::string()), "Name of file containing a point weights. Format is one weight per line:\n W1\n ...\n Wn ")( "cuboid-file,c", po::value(&cuboid_file), @@ -303,7 +303,7 @@ void program_options(int argc, char *argv[], std::string &off_file_points, bool std::cout << std::endl; std::cout << "Compute the persistent homology with coefficient field Z/pZ \n"; std::cout << "of a 3D Alpha complex defined on a set of input points.\n"; - std::cout << "3D Alpha complex can be exact or safe, weighted and/or periodic\n\n"; + std::cout << "3D Alpha complex can be safe (by default) exact or fast, weighted and/or periodic\n\n"; std::cout << "The output diagram contains one bar per line, written with the convention: \n"; std::cout << " p dim b d \n"; std::cout << "where dim is the dimension of the homological feature,\n"; diff --git a/src/Alpha_complex/utilities/alphacomplex.md b/src/Alpha_complex/utilities/alphacomplex.md index 98f56802..50a39d32 100644 --- a/src/Alpha_complex/utilities/alphacomplex.md +++ b/src/Alpha_complex/utilities/alphacomplex.md @@ -107,6 +107,7 @@ It must be in the format described points (one value per line). * `-e [ --exact ]` for the exact computation version (not compatible with weight and periodic version). +* `-f [ --fast ]` for the fast computation version. **Example** -- cgit v1.2.3