From 8d7329f3e5ad843e553c3c5503cecc28ef2eead6 Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Thu, 20 Apr 2017 11:10:45 +0200 Subject: GUDHI 2.0.0 as released by upstream in a tarball. --- example/Contraction/CMakeLists.txt | 9 +++++--- example/Contraction/Garland_heckbert.cpp | 26 +++++++++------------- .../Contraction/Garland_heckbert/Error_quadric.h | 6 ++--- example/Contraction/Rips_contraction.cpp | 25 +++++++++------------ 4 files changed, 30 insertions(+), 36 deletions(-) (limited to 'example/Contraction') diff --git a/example/Contraction/CMakeLists.txt b/example/Contraction/CMakeLists.txt index 4c09a0a7..51a6832d 100644 --- a/example/Contraction/CMakeLists.txt +++ b/example/Contraction/CMakeLists.txt @@ -9,7 +9,10 @@ target_link_libraries(RipsContraction ${Boost_TIMER_LIBRARY} ${Boost_SYSTEM_LIBR target_link_libraries(GarlandHeckbert ${Boost_TIMER_LIBRARY} ${Boost_SYSTEM_LIBRARY}) -add_test(RipsContraction.tore3D.0.2 ${CMAKE_CURRENT_BINARY_DIR}/RipsContraction ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off 0.2) +add_test(NAME Contraction_example_tore3D_0.2 COMMAND $ + "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "0.2") # TODO(DS) : These tests are too long under Windows -#add_test(RipsContraction.sphere.0.2 ${CMAKE_CURRENT_BINARY_DIR}/RipsContraction ${CMAKE_SOURCE_DIR}/data/points/sphere3D_2646.off 0.2) -#add_test(RipsContraction.S0310000 ${CMAKE_CURRENT_BINARY_DIR}/RipsContraction ${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off 0.3) +#add_test(NAME Contraction_example_sphere_0.2 COMMAND $ +# "${CMAKE_SOURCE_DIR}/data/points/sphere3D_2646.off" "0.2") +#add_test(NAME Contraction_example_SO3_0.3 COMMAND $ +# "${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off" "0.3") diff --git a/example/Contraction/Garland_heckbert.cpp b/example/Contraction/Garland_heckbert.cpp index cbc46e91..8b5a6a6c 100644 --- a/example/Contraction/Garland_heckbert.cpp +++ b/example/Contraction/Garland_heckbert.cpp @@ -35,11 +35,6 @@ #include "Garland_heckbert/Error_quadric.h" -using namespace std; -using namespace Gudhi; -using namespace skeleton_blocker; -using namespace contraction; - struct Geometry_trait { typedef Point_d Point; }; @@ -47,7 +42,8 @@ struct Geometry_trait { /** * The vertex stored in the complex contains a quadric. */ -struct Garland_heckbert_traits : public Skeleton_blocker_simple_geometric_traits { +struct Garland_heckbert_traits + : public Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits { public: struct Garland_heckbert_vertex : public Simple_geometric_vertex { Error_quadric quadric; @@ -55,9 +51,9 @@ struct Garland_heckbert_traits : public Skeleton_blocker_simple_geometric_traits typedef Garland_heckbert_vertex Graph_vertex; }; -typedef Skeleton_blocker_geometric_complex< Garland_heckbert_traits > Complex; -typedef Edge_profile EdgeProfile; -typedef Skeleton_blocker_contractor Complex_contractor; +using Complex = Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex< Garland_heckbert_traits >; +using EdgeProfile = Gudhi::contraction::Edge_profile; +using Complex_contractor = Gudhi::contraction::Skeleton_blocker_contractor; /** * How the new vertex is placed after an edge collapse : here it is placed at @@ -69,7 +65,7 @@ class GH_placement : public Gudhi::contraction::Placement_policy { public: typedef Gudhi::contraction::Placement_policy::Placement_type Placement_type; - GH_placement(Complex& complex) : complex_(complex) { } + GH_placement(Complex& complex) : complex_(complex) { (void)complex_; } Placement_type operator()(const EdgeProfile& profile) const override { auto sum_quad(profile.v0().quadric); @@ -93,7 +89,7 @@ class GH_cost : public Gudhi::contraction::Cost_policy { public: typedef Gudhi::contraction::Cost_policy::Cost_type Cost_type; - GH_cost(Complex& complex) : complex_(complex) { } + GH_cost(Complex& complex) : complex_(complex) { (void)complex_; } Cost_type operator()(EdgeProfile const& profile, boost::optional const& new_point) const override { Cost_type res; @@ -115,7 +111,7 @@ class GH_visitor : public Gudhi::contraction::Contraction_visitor { Complex& complex_; public: - GH_visitor(Complex& complex) : complex_(complex) { } + GH_visitor(Complex& complex) : complex_(complex) { (void)complex_; } // Compute quadrics for every vertex v // The quadric of v consists in the sum of quadric @@ -154,7 +150,7 @@ int main(int argc, char *argv[]) { typedef Complex::Vertex_handle Vertex_handle; // load the points - Skeleton_blocker_off_reader off_reader(argv[1], complex); + Gudhi::skeleton_blocker::Skeleton_blocker_off_reader off_reader(argv[1], complex); if (!off_reader.is_valid()) { std::cerr << "Unable to read file:" << argv[1] << std::endl; return EXIT_FAILURE; @@ -175,7 +171,7 @@ int main(int argc, char *argv[]) { Complex_contractor contractor(complex, new GH_cost(complex), new GH_placement(complex), - contraction::make_link_valid_contraction(), + Gudhi::contraction::make_link_valid_contraction(), new GH_visitor(complex)); std::cout << "Contract " << num_contractions << " edges" << std::endl; @@ -187,7 +183,7 @@ int main(int argc, char *argv[]) { complex.num_triangles() << " triangles." << std::endl; // write simplified complex - Skeleton_blocker_off_writer off_writer(argv[2], complex); + Gudhi::skeleton_blocker::Skeleton_blocker_off_writer off_writer(argv[2], complex); return EXIT_SUCCESS; } diff --git a/example/Contraction/Garland_heckbert/Error_quadric.h b/example/Contraction/Garland_heckbert/Error_quadric.h index 076f1be0..e7dafaa0 100644 --- a/example/Contraction/Garland_heckbert/Error_quadric.h +++ b/example/Contraction/Garland_heckbert/Error_quadric.h @@ -21,8 +21,8 @@ * */ -#ifndef ERROR_QUADRIC_H_ -#define ERROR_QUADRIC_H_ +#ifndef GARLAND_HECKBERT_ERROR_QUADRIC_H_ +#define GARLAND_HECKBERT_ERROR_QUADRIC_H_ #include @@ -179,4 +179,4 @@ template class Error_quadric { } }; -#endif // ERROR_QUADRIC_H_ +#endif // GARLAND_HECKBERT_ERROR_QUADRIC_H_ diff --git a/example/Contraction/Rips_contraction.cpp b/example/Contraction/Rips_contraction.cpp index 978dd1cb..8289b1d3 100644 --- a/example/Contraction/Rips_contraction.cpp +++ b/example/Contraction/Rips_contraction.cpp @@ -27,20 +27,15 @@ #include #include -using namespace std; -using namespace Gudhi; -using namespace skeleton_blocker; -using namespace contraction; - struct Geometry_trait { typedef Point_d Point; }; -typedef Geometry_trait::Point Point; -typedef Skeleton_blocker_simple_geometric_traits Complex_geometric_traits; -typedef Skeleton_blocker_geometric_complex< Complex_geometric_traits > Complex; -typedef Edge_profile Profile; -typedef Skeleton_blocker_contractor Complex_contractor; +using Complex_geometric_traits = Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits; +using Complex = Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex< Complex_geometric_traits >; +using Profile = Gudhi::contraction::Edge_profile; +using Complex_contractor = Gudhi::contraction::Skeleton_blocker_contractor; + template void build_rips(ComplexType& complex, double offset) { @@ -63,7 +58,7 @@ int main(int argc, char *argv[]) { Complex complex; // load only the points - Skeleton_blocker_off_reader off_reader(argv[1], complex, true); + Gudhi::skeleton_blocker::Skeleton_blocker_off_reader off_reader(argv[1], complex, true); if (!off_reader.is_valid()) { std::cerr << "Unable to read file:" << argv[1] << std::endl; return EXIT_FAILURE; @@ -80,10 +75,10 @@ int main(int argc, char *argv[]) { complex.num_edges() << " edges" << std::endl; Complex_contractor contractor(complex, - new Edge_length_cost, - contraction::make_first_vertex_placement(), - contraction::make_link_valid_contraction(), - contraction::make_remove_popable_blockers_visitor()); + new Gudhi::contraction::Edge_length_cost, + Gudhi::contraction::make_first_vertex_placement(), + Gudhi::contraction::make_link_valid_contraction(), + Gudhi::contraction::make_remove_popable_blockers_visitor()); contractor.contract_edges(); std::cout << "Counting final number of simplices \n"; -- cgit v1.2.3