From 35fee4017481fd3f62fceb76a1b2bc8cd0f15b95 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 7 Sep 2018 14:17:13 +0000 Subject: Code review : rearrange documentation and examples according to making choices more orthogonal Rename Alpha_complex_3d_options.h Alpha_complex_options.h as it can be used by Alpha complex dD git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3875 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6c5b105248e4766a44438a187bb130a3722b310f --- .../utilities/alpha_complex_3d_persistence.cpp | 120 ++++++++++++++++----- 1 file changed, 92 insertions(+), 28 deletions(-) (limited to 'src/Alpha_complex/utilities') diff --git a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp index 536de444..1a152541 100644 --- a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp +++ b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -34,16 +33,24 @@ #include // gudhi type definition -using Weighted_periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Periodic_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Exact_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; -using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; using Simplex_tree = Gudhi::Simplex_tree; using Filtration_value = Simplex_tree::Filtration_value; using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology; +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_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; + 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); @@ -98,6 +105,72 @@ int main(int argc, char **argv) { program_options(argc, argv, off_file_points, exact_version, weight_file, cuboid_file, output_file_diag, alpha_square_max_value, coeff_field_characteristic, min_persistence); + Gudhi::alpha_complex::complexity complexity = Gudhi::alpha_complex::complexity::fast; + if (exact_version) { + complexity = Gudhi::alpha_complex::complexity::exact; + } + + switch(complexity) { + case Gudhi::alpha_complex::complexity::fast: + if (weighted_version) { + if (periodic_version) { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } else { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } + } else { + if (periodic_version) { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } else { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } + } + break; + case Gudhi::alpha_complex::complexity::exact: + if (weighted_version) { + if (periodic_version) { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } else { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } + } else { + if (periodic_version) { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } else { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } + } + break; + case Gudhi::alpha_complex::complexity::safe: + if (weighted_version) { + if (periodic_version) { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } else { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } + } else { + if (periodic_version) { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } else { + using Alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d; + } + } + break; + } + + /*const Gudhi::alpha_complex::complexity complexity_(complexity); // Read the OFF file (input file name given as parameter) and triangulate points Gudhi::Points_3D_off_reader off_reader(off_file_points); // Check the read operation was correct @@ -127,35 +200,26 @@ int main(int argc, char **argv) { Simplex_tree simplex_tree; - if (exact_version) { - if ((weighted_version) || (periodic_version)) { - std::cerr << "Unable to compute exact version of a weighted and/or periodic alpha shape" << std::endl; - exit(-1); + if (weighted_version) { + if (periodic_version) { + Alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights, + x_min, y_min, z_min, x_max, y_max, z_max); + create_complex(alpha_complex, simplex_tree, alpha_square_max_value); } else { - Exact_alpha_complex_3d alpha_complex(off_reader.get_point_cloud()); + Alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights); create_complex(alpha_complex, simplex_tree, alpha_square_max_value); } } else { - if (weighted_version) { - if (periodic_version) { - Weighted_periodic_alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights, - x_min, y_min, z_min, x_max, y_max, z_max); - create_complex(alpha_complex, simplex_tree, alpha_square_max_value); - } else { - Weighted_alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), weights); - create_complex(alpha_complex, simplex_tree, alpha_square_max_value); - } + if (periodic_version) { + Alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), x_min, y_min, z_min, x_max, y_max, z_max); + create_complex(alpha_complex, simplex_tree, alpha_square_max_value); } else { - if (periodic_version) { - Periodic_alpha_complex_3d alpha_complex(off_reader.get_point_cloud(), x_min, y_min, z_min, x_max, y_max, z_max); - create_complex(alpha_complex, simplex_tree, alpha_square_max_value); - } else { - Alpha_complex_3d alpha_complex(off_reader.get_point_cloud()); - create_complex(alpha_complex, simplex_tree, alpha_square_max_value); - } + Alpha_complex_3d alpha_complex(off_reader.get_point_cloud()); + create_complex(alpha_complex, simplex_tree, alpha_square_max_value); } } + // Sort the simplices in the order of the filtration simplex_tree.initialize_filtration(); @@ -175,7 +239,7 @@ int main(int argc, char **argv) { std::ofstream out(output_file_diag); pcoh.output_diagram(out); out.close(); - } + }*/ return 0; } -- cgit v1.2.3