diff options
Diffstat (limited to 'src/Persistent_cohomology')
7 files changed, 49 insertions, 47 deletions
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt index 20700d86..a6b698c3 100644 --- a/src/Persistent_cohomology/example/CMakeLists.txt +++ b/src/Persistent_cohomology/example/CMakeLists.txt @@ -81,28 +81,26 @@ if(CGAL_FOUND) ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.weights 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) + if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) + 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 (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) endif(CGAL_FOUND) diff --git a/src/Persistent_cohomology/example/alpha_complex_3d_helper.h b/src/Persistent_cohomology/example/alpha_complex_3d_helper.h index ceefd2ba..7865e4ec 100644 --- a/src/Persistent_cohomology/example/alpha_complex_3d_helper.h +++ b/src/Persistent_cohomology/example/alpha_complex_3d_helper.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef EXAMPLE_PERSISTENT_COHOMOLOGY_ALPHA_COMPLEX_3D_HELPER_H_ -#define EXAMPLE_PERSISTENT_COHOMOLOGY_ALPHA_COMPLEX_3D_HELPER_H_ +#ifndef ALPHA_COMPLEX_3D_HELPER_H_ +#define ALPHA_COMPLEX_3D_HELPER_H_ template<class Vertex_list, class Cell_handle> Vertex_list from_cell(const Cell_handle& ch) { @@ -73,4 +73,4 @@ Vertex_list from_vertex(const Vertex_handle& vh) { return the_list; } -#endif // EXAMPLE_PERSISTENT_COHOMOLOGY_ALPHA_COMPLEX_3D_HELPER_H_ +#endif // ALPHA_COMPLEX_3D_HELPER_H_ diff --git a/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp index ffb98283..fd227b82 100644 --- a/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp @@ -20,18 +20,17 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/variant.hpp> + #include <gudhi/Simplex_tree.h> #include <gudhi/Persistent_cohomology.h> #include <gudhi/Points_3D_off_io.h> -#include <boost/variant.hpp> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Delaunay_triangulation_3.h> #include <CGAL/Alpha_shape_3.h> #include <CGAL/iterator.h> -#include "alpha_complex_3d_helper.h" - #include <fstream> #include <cmath> #include <string> @@ -41,6 +40,8 @@ #include <list> #include <vector> +#include "alpha_complex_3d_helper.h" + // Alpha_shape_3 templates type definitions using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; using Vb = CGAL::Alpha_shape_vertex_base_3<Kernel>; diff --git a/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp index c016a596..8a335075 100644 --- a/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp @@ -20,18 +20,17 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/variant.hpp> + #include <gudhi/Simplex_tree.h> #include <gudhi/Persistent_cohomology.h> #include <gudhi/Points_3D_off_io.h> -#include <boost/variant.hpp> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Delaunay_triangulation_3.h> #include <CGAL/Alpha_shape_3.h> #include <CGAL/iterator.h> -#include "alpha_complex_3d_helper.h" - #include <fstream> #include <cmath> #include <string> @@ -41,6 +40,8 @@ #include <list> #include <vector> +#include "alpha_complex_3d_helper.h" + // Alpha_shape_3 templates type definitions using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; using Exact_tag = CGAL::Tag_true; 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 4f6ea40e..8928cfc2 100644 --- a/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp @@ -20,10 +20,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/variant.hpp> + #include <gudhi/Simplex_tree.h> #include <gudhi/Persistent_cohomology.h> #include <gudhi/Points_3D_off_io.h> -#include <boost/variant.hpp> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h> @@ -31,8 +32,6 @@ #include <CGAL/Alpha_shape_3.h> #include <CGAL/iterator.h> -#include "alpha_complex_3d_helper.h" - #include <fstream> #include <cmath> #include <string> @@ -43,6 +42,8 @@ #include <vector> #include <cstdlib> +#include "alpha_complex_3d_helper.h" + // Traits using K = CGAL::Exact_predicates_inexact_constructions_kernel; using PK = CGAL::Periodic_3_Delaunay_triangulation_traits_3<K>; diff --git a/src/Persistent_cohomology/example/plain_homology.cpp b/src/Persistent_cohomology/example/plain_homology.cpp index ae82c817..50f692f2 100644 --- a/src/Persistent_cohomology/example/plain_homology.cpp +++ b/src/Persistent_cohomology/example/plain_homology.cpp @@ -27,13 +27,11 @@ #include <vector> #include <cstdint> // for std::uint8_t -using namespace Gudhi; - /* We could perfectly well use the default Simplex_tree<> (which uses * Simplex_tree_options_full_featured), the following simply demonstrates * how to save on storage by not storing a filtration value. */ -struct MyOptions : Simplex_tree_options_full_featured { +struct MyOptions : 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 @@ -43,7 +41,10 @@ struct MyOptions : Simplex_tree_options_full_featured { // 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; + +using ST = Gudhi::Simplex_tree<MyOptions>; +using Field_Zp = Gudhi::persistent_cohomology::Field_Zp; +using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<ST, Field_Zp>; int main() { ST st; @@ -70,7 +71,7 @@ int main() { st.initialize_filtration(); // Class for homology computation - persistent_cohomology::Persistent_cohomology<ST, persistent_cohomology::Field_Zp> pcoh(st); + Persistent_cohomology pcoh(st); // Initialize the coefficient field Z/2Z for homology pcoh.init_coefficients(2); diff --git a/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp index 5203548a..34b90933 100644 --- a/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp @@ -20,10 +20,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/variant.hpp> + #include <gudhi/Simplex_tree.h> #include <gudhi/Persistent_cohomology.h> #include <gudhi/Points_3D_off_io.h> -#include <boost/variant.hpp> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Regular_triangulation_euclidean_traits_3.h> @@ -31,8 +32,6 @@ #include <CGAL/Alpha_shape_3.h> #include <CGAL/iterator.h> -#include "alpha_complex_3d_helper.h" - #include <fstream> #include <cmath> #include <string> @@ -43,13 +42,15 @@ #include <vector> #include <cstdlib> +#include "alpha_complex_3d_helper.h" + // Traits using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; using Gt = CGAL::Regular_triangulation_euclidean_traits_3<Kernel>; using Vb = CGAL::Alpha_shape_vertex_base_3<Gt>; using Fb = CGAL::Alpha_shape_cell_base_3<Gt>; using Tds = CGAL::Triangulation_data_structure_3<Vb, Fb>; -using Triangulation_3 = CGAL::Regular_triangulation_3<Gt,Tds>; +using Triangulation_3 = CGAL::Regular_triangulation_3<Gt, Tds>; using Alpha_shape_3 = CGAL::Alpha_shape_3<Triangulation_3>; // From file type definition @@ -115,8 +116,7 @@ int main(int argc, char * const argv[]) { double weight = 0.0; std::size_t index = 0; // Attempt read the weight in a double format, return false if it fails - while((weights_ifstr >> weight) && (index < lp.size())) - { + while ((weights_ifstr >> weight) && (index < lp.size())) { wp.push_back(Weighted_point_3(lp[index], weight)); index++; } |