From 5624cfc39b51dd7f201b11c45b5ca5f218591c04 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 25 Sep 2018 15:26:41 +0000 Subject: Constants shall be upper case git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3906 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fcafbe39665a69c6645f8b9d73fc67b98709540e --- .../benchmark/Alpha_complex_3d_benchmark.cpp | 24 ++++++------ .../example/Alpha_complex_3d_from_points.cpp | 2 +- .../Weighted_alpha_complex_3d_from_points.cpp | 2 +- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 34 +++++++++++++---- .../include/gudhi/Alpha_complex_options.h | 10 ++--- .../test/Alpha_complex_3d_unit_test.cpp | 24 ++++++------ .../utilities/alpha_complex_3d_persistence.cpp | 44 +++++++++++----------- 7 files changed, 77 insertions(+), 63 deletions(-) (limited to 'src/Alpha_complex') diff --git a/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp b/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp index ad785f4e..3e556cdf 100644 --- a/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp +++ b/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp @@ -233,33 +233,33 @@ int main(int argc, char **argv) { benchmark_points_on_torus_dD >>("Exact static dimension version"); benchmark_points_on_torus_dD>("Exact dynamic dimension version"); - benchmark_points_on_torus_3D>("Fast version"); - benchmark_points_on_torus_3D>("Safe version"); - benchmark_points_on_torus_3D>("Exact version"); - benchmark_weighted_points_on_torus_3D>("Fast version"); - benchmark_weighted_points_on_torus_3D>("Safe version"); - benchmark_weighted_points_on_torus_3D>("Exact version"); - benchmark_periodic_points>("Fast version"); - benchmark_periodic_points>("Safe version"); - benchmark_periodic_points>("Exact version"); - benchmark_weighted_periodic_points>("Fast version"); - benchmark_weighted_periodic_points>("Safe version"); - benchmark_weighted_periodic_points>("Exact version"); return 0; diff --git a/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp b/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp index e96385c0..5d6e65cb 100644 --- a/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp +++ b/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp @@ -7,7 +7,7 @@ #include #include // for numeric limits -using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; using Point = Alpha_complex_3d::Point_3 ; using Vector_of_points = std::vector; diff --git a/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp index 61ceab6d..52c39bf3 100644 --- a/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp +++ b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp @@ -7,7 +7,7 @@ #include #include // for numeric limits -using Weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; using Point = Weighted_alpha_complex_3d::Point_3; using Weighted_point = Weighted_alpha_complex_3d::Triangulation_3::Weighted_point; using Vector_of_weighted_points = std::vector; diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index 42f49e15..1ba52ad0 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -69,6 +69,11 @@ namespace Gudhi { namespace alpha_complex { +// Value_from_iterator returns the filtration value from an iterator on alpha shapes values +// +// FAST SAFE EXACT +// *iterator CGAL::to_double(*iterator) CGAL::to_double(iterator->exact()) + template struct Value_from_iterator { @@ -81,23 +86,23 @@ struct Value_from_iterator }; template <> -struct Value_from_iterator +struct Value_from_iterator { template static double perform(Iterator it) { - // In safe mode, we are with Epeck or Epick with exact value set to CGAL::Tag_true. + // In SAFE mode, we are with Epeck or Epick with EXACT value set to CGAL::Tag_true. return CGAL::to_double(*it); } }; template <> -struct Value_from_iterator +struct Value_from_iterator { template static double perform(Iterator it) { - // In exact mode, we are with Epeck or Epick with exact value set to CGAL::Tag_true. + // In EXACT mode, we are with Epeck or Epick with EXACT value set to CGAL::Tag_true. return CGAL::to_double(it->exact()); } }; @@ -115,7 +120,7 @@ struct Value_from_iterator * Duplicate points are inserted once in the Alpha_complex. This is the reason why the vertices may be not contiguous. * * \tparam Complexity shall be `Gudhi::alpha_complex::complexity`. Default value is - * `Gudhi::alpha_complex::complexity::fast`. + * `Gudhi::alpha_complex::complexity::FAST`. * * \tparam Weighted Boolean used to set/unset the weighted version of Alpha_complex_3d. Default value is false. * @@ -138,9 +143,22 @@ struct Value_from_iterator * 3d Delaunay complex. * */ -template +template class Alpha_complex_3d { - using Predicates = typename std::conditional<((!Weighted && !Periodic) || (Complexity == complexity::fast)), + // Epick = Exact_predicates_inexact_constructions_kernel + // Epeck = Exact_predicates_exact_constructions_kernel + // ExactAlphaComparisonTag = exact version of CGAL Alpha_shape_3 and of its objects (Alpha_shape_vertex_base_3 and + // Alpha_shape_cell_base_3). Not available if weighted or periodic. + // Can be CGAL::Tag_false or CGAL::Tag_true + // cf. https://doc.cgal.org/latest/Alpha_shapes_3/classCGAL_1_1Alpha__shape__3.html + // + // + // FAST SAFE EXACT + // not weighted and Epick + CGAL::Tag_false Epick + CGAL::Tag_true Epick + CGAL::Tag_true + // not periodic + // + // otherwise Epick + CGAL::Tag_false Epeck Epeck + using Predicates = typename std::conditional<((!Weighted && !Periodic) || (Complexity == complexity::FAST)), CGAL::Exact_predicates_inexact_constructions_kernel, CGAL::Exact_predicates_exact_constructions_kernel>::type; @@ -166,7 +184,7 @@ class Alpha_complex_3d { using Kernel = typename Kernel_3::Kernel; - using Exact_tag = typename std::conditional<(Complexity == complexity::fast), + using Exact_tag = typename std::conditional<(Complexity == complexity::FAST), CGAL::Tag_false, CGAL::Tag_true>::type; diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_options.h b/src/Alpha_complex/include/gudhi/Alpha_complex_options.h index cd9fe799..29eb514a 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_options.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_options.h @@ -29,19 +29,15 @@ namespace Gudhi { namespace alpha_complex { /** - * \class complexity * \brief Alpha complex complexity template parameter possible values. * * \ingroup alpha_complex */ enum class complexity: char { - /** \brief Fast version.*/ - fast='f', - /** \brief Safe version.*/ - safe='s', - /** \brief Exact version.*/ - exact='e', + FAST='f', ///< Fast version. + SAFE='s', ///< Safe version. + EXACT='e', ///< Exact version. }; } // namespace alpha_complex diff --git a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp index d09e8c10..a32e88a6 100644 --- a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp +++ b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp @@ -42,21 +42,21 @@ #include #include -using Fast_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Safe_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Exact_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Fast_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Safe_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Exact_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Fast_weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Safe_weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Exact_weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Fast_weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Safe_weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Exact_weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Fast_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Safe_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Exact_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Fast_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Safe_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Exact_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Fast_weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Safe_weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Exact_weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Fast_weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Safe_weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; +using Exact_weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // ----------------- diff --git a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp index fb1418bb..c2b49fed 100644 --- a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp +++ b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp @@ -38,7 +38,7 @@ using Filtration_value = Simplex_tree::Filtration_value; using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology; -void program_options(int argc, char *argv[], std::string &off_file_points, bool& exact, std::string &weight_file, +void program_options(int argc, char *argv[], std::string &off_file_points, bool& EXACT, 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); @@ -117,24 +117,24 @@ 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::FAST; if (exact_version) { - complexity = Gudhi::alpha_complex::complexity::exact; + complexity = Gudhi::alpha_complex::complexity::EXACT; } Simplex_tree simplex_tree; switch(complexity) { - case Gudhi::alpha_complex::complexity::fast: + case Gudhi::alpha_complex::complexity::FAST: if (weighted_version) { if (periodic_version) { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points, weights, x_min, y_min, z_min, x_max, y_max, z_max); alpha_complex.create_complex(simplex_tree, alpha_square_max_value); } else { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points, weights); @@ -142,13 +142,13 @@ int main(int argc, char **argv) { } } else { if (periodic_version) { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points, x_min, y_min, z_min, x_max, y_max, z_max); alpha_complex.create_complex(simplex_tree, alpha_square_max_value); } else { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points); @@ -156,16 +156,16 @@ int main(int argc, char **argv) { } } break; - case Gudhi::alpha_complex::complexity::exact: + case Gudhi::alpha_complex::complexity::EXACT: if (weighted_version) { if (periodic_version) { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points, weights, x_min, y_min, z_min, x_max, y_max, z_max); alpha_complex.create_complex(simplex_tree, alpha_square_max_value); } else { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points, weights); @@ -173,13 +173,13 @@ int main(int argc, char **argv) { } } else { if (periodic_version) { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points, x_min, y_min, z_min, x_max, y_max, z_max); alpha_complex.create_complex(simplex_tree, alpha_square_max_value); } else { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points); @@ -187,16 +187,16 @@ int main(int argc, char **argv) { } } break; - case Gudhi::alpha_complex::complexity::safe: + case Gudhi::alpha_complex::complexity::SAFE: if (weighted_version) { if (periodic_version) { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points, weights, x_min, y_min, z_min, x_max, y_max, z_max); alpha_complex.create_complex(simplex_tree, alpha_square_max_value); } else { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points, weights); @@ -204,13 +204,13 @@ int main(int argc, char **argv) { } } else { if (periodic_version) { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points, x_min, y_min, z_min, x_max, y_max, z_max); alpha_complex.create_complex(simplex_tree, alpha_square_max_value); } else { - using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; auto points = read_off(off_file_points); Alpha_complex_3d alpha_complex(points); @@ -248,7 +248,7 @@ int main(int argc, char **argv) { return 0; } -void program_options(int argc, char *argv[], std::string &off_file_points, bool& exact, std::string &weight_file, +void program_options(int argc, char *argv[], std::string &off_file_points, bool& EXACT, 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) { namespace po = boost::program_options; @@ -258,8 +258,8 @@ 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 for weighted and/or periodic)")( + "EXACT,e", po::bool_switch(&EXACT), + "To activate EXACT version of Alpha complex 3d (default is false, not available for weighted and/or periodic)")( "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), @@ -289,7 +289,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 weighted and/or periodic\n\n"; + std::cout << "3D Alpha complex can be EXACT or 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"; -- cgit v1.2.3