summaryrefslogtreecommitdiff
path: root/GudhUI
diff options
context:
space:
mode:
authorGard Spreemann <gspreemann@gmail.com>2017-04-20 11:10:45 +0200
committerGard Spreemann <gspreemann@gmail.com>2017-04-20 11:10:45 +0200
commit8d7329f3e5ad843e553c3c5503cecc28ef2eead6 (patch)
tree6d80d83a7c4bcd3296e12a28404bfe84ef84ed55 /GudhUI
parent55c7181126aa7defce38c9b82872d14223d4c1dd (diff)
GUDHI 2.0.0 as released by upstream in a tarball.upstream/2.0.0
Diffstat (limited to 'GudhUI')
-rw-r--r--GudhUI/CMakeLists.txt69
-rw-r--r--GudhUI/gui/MainWindow.h4
-rw-r--r--GudhUI/gui/Menu_edge_contraction.h5
-rw-r--r--GudhUI/gui/Menu_k_nearest_neighbors.h2
-rw-r--r--GudhUI/gui/Menu_persistence.h2
-rw-r--r--GudhUI/gui/Menu_uniform_neighbors.h2
-rw-r--r--GudhUI/model/Model.h10
-rw-r--r--GudhUI/utils/Critical_points.h1
-rw-r--r--GudhUI/utils/Edge_contractor.h2
-rw-r--r--GudhUI/utils/Furthest_point_epsilon_net.h2
-rw-r--r--GudhUI/utils/Is_manifold.h1
-rw-r--r--GudhUI/utils/Persistence_compute.h17
-rw-r--r--GudhUI/utils/Vertex_collapsor.h1
-rw-r--r--GudhUI/view/FirstCoordProjector.h6
-rw-r--r--GudhUI/view/Viewer.h3
-rw-r--r--GudhUI/view/Viewer_instructor.h3
16 files changed, 62 insertions, 68 deletions
diff --git a/GudhUI/CMakeLists.txt b/GudhUI/CMakeLists.txt
index a43294ea..ca2e47c1 100644
--- a/GudhUI/CMakeLists.txt
+++ b/GudhUI/CMakeLists.txt
@@ -1,46 +1,42 @@
cmake_minimum_required(VERSION 2.8)
project(GudhUI)
-find_package(Qt4)
+find_package(Qt5 COMPONENTS Widgets Xml OpenGL)
find_package(QGLViewer)
find_package(OpenGL)
-if ( CGAL_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
- set( QT_USE_QTXML TRUE )
- set( QT_USE_QTMAIN TRUE )
- set( QT_USE_QTSCRIPT TRUE )
- set( QT_USE_QTOPENGL TRUE )
- SET(Boost_USE_STATIC_LIBS ON)
- SET(Boost_USE_MULTITHREAD OFF)
+if (CGAL_VERSION VERSION_EQUAL 4.8.0)
+ message(ERROR " GudhUI does not compile with CGAL 4.8.0. 4.8.1, 4.8.2 and 4.9 are OK.")
+endif()
+
+if (NOT CGAL_FOUND)
+ message(ERROR " GudhUI requires CGAL and will not be compiled.")
+endif()
+
+if (NOT Qt5_FOUND)
+ message(ERROR " GudhUI requires Qt5 and will not be compiled.")
+endif()
+
+if (NOT OPENGL_FOUND)
+ message(ERROR " GudhUI requires OpenGL and will not be compiled.")
+endif()
+
+if (NOT QGLVIEWER_FOUND)
+ message(ERROR " GudhUI requires QGLViewer and will not be compiled.")
+endif()
- include(${QT_USE_FILE})
+
+if ( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND NOT CGAL_VERSION VERSION_EQUAL 4.8.0)
+
+ set(CMAKE_AUTOMOC ON)
+ set(CMAKE_AUTOUIC ON)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+ SET(Boost_USE_STATIC_LIBS ON)
+ SET(Boost_USE_MULTITHREAD OFF)
include_directories (${QGLVIEWER_INCLUDE_DIR})
- include_directories(.)
- # qt : ui file, created wih Qt Designer ###############
- set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gui")
- qt4_wrap_ui( uis
- gui/main_window.ui
- gui/MenuEdgeContraction.ui
- gui/KNearestNeighborsMenu.ui
- gui/UniformNeighborsMenu.ui
- gui/PersistenceMenu.ui
- )
-
- set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gui")
- qt4_automoc(
- gui/MainWindow.cpp
- gui/Menu_k_nearest_neighbors.cpp
- gui/Menu_uniform_neighbors.cpp
- gui/Menu_edge_contraction.cpp
- gui/Menu_persistence.cpp
- )
-
- set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/view")
- qt4_automoc(view/Viewer_instructor.cpp
- view/Viewer.cpp
- )
#####################################################################
add_executable ( GudhUI
@@ -52,10 +48,9 @@ if ( CGAL_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
gui/Menu_persistence.cpp
view/Viewer_instructor.cpp
view/Viewer.cpp
- ${uis}
)
-
- target_link_libraries( GudhUI ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} )
+ target_link_libraries( GudhUI Qt5::Widgets Qt5::Xml Qt5::OpenGL )
+ target_link_libraries( GudhUI ${QGLVIEWER_LIBRARIES} )
target_link_libraries( GudhUI ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
if (TBB_FOUND)
target_link_libraries( GudhUI ${TBB_LIBRARIES})
@@ -64,5 +59,5 @@ endif()
###############################################################################
else()
- message(STATUS "NOTICE: GudhUI requires CGAL, the QGLViewer, OpenGL and Qt4, and will not be compiled.")
+ message(STATUS "NOTICE: GudhUI requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.")
endif()
diff --git a/GudhUI/gui/MainWindow.h b/GudhUI/gui/MainWindow.h
index c8c3fcf6..15664dcb 100644
--- a/GudhUI/gui/MainWindow.h
+++ b/GudhUI/gui/MainWindow.h
@@ -23,8 +23,8 @@
#ifndef GUI_MAINWINDOW_H_
#define GUI_MAINWINDOW_H_
-// Workaround for moc-qt4 not parsing boost headers
-#include <CGAL/config.h>
+// Workaround https://svn.boost.org/trac/boost/ticket/12534
+#include <boost/container/flat_map.hpp>
#include <QMainWindow>
#include "ui_main_window.h"
diff --git a/GudhUI/gui/Menu_edge_contraction.h b/GudhUI/gui/Menu_edge_contraction.h
index 08f0bf67..2d5640e8 100644
--- a/GudhUI/gui/Menu_edge_contraction.h
+++ b/GudhUI/gui/Menu_edge_contraction.h
@@ -23,11 +23,8 @@
#ifndef GUI_MENU_EDGE_CONTRACTION_H_
#define GUI_MENU_EDGE_CONTRACTION_H_
-// Workaround for moc-qt4 not parsing boost headers
-#include <CGAL/config.h>
-
#include "gui/MainWindow.h"
-#include "gui/ui_MenuEdgeContraction.h"
+#include "ui_MenuEdgeContraction.h"
#include "model/Model.h"
diff --git a/GudhUI/gui/Menu_k_nearest_neighbors.h b/GudhUI/gui/Menu_k_nearest_neighbors.h
index 8088b768..77303b67 100644
--- a/GudhUI/gui/Menu_k_nearest_neighbors.h
+++ b/GudhUI/gui/Menu_k_nearest_neighbors.h
@@ -24,7 +24,7 @@
#define GUI_MENU_K_NEAREST_NEIGHBORS_H_
#include <QMainWindow>
-#include "gui/ui_KNearestNeighborsMenu.h"
+#include "ui_KNearestNeighborsMenu.h"
class QWidget;
diff --git a/GudhUI/gui/Menu_persistence.h b/GudhUI/gui/Menu_persistence.h
index 8c4df158..1a2a2408 100644
--- a/GudhUI/gui/Menu_persistence.h
+++ b/GudhUI/gui/Menu_persistence.h
@@ -25,7 +25,7 @@
#define GUI_MENU_PERSISTENCE_H_
#include <QMainWindow>
-#include "gui/ui_PersistenceMenu.h"
+#include "ui_PersistenceMenu.h"
class QWidget;
diff --git a/GudhUI/gui/Menu_uniform_neighbors.h b/GudhUI/gui/Menu_uniform_neighbors.h
index 0b6f65fe..61316966 100644
--- a/GudhUI/gui/Menu_uniform_neighbors.h
+++ b/GudhUI/gui/Menu_uniform_neighbors.h
@@ -25,7 +25,7 @@
#define GUI_MENU_UNIFORM_NEIGHBORS_H_
#include <QMainWindow>
-#include "gui/ui_UniformNeighborsMenu.h"
+#include "ui_UniformNeighborsMenu.h"
class Menu_uniform_neighbors : public QDialog, public Ui::UniformMenu {
Q_OBJECT
diff --git a/GudhUI/model/Model.h b/GudhUI/model/Model.h
index 1c39c0d7..fc284cc6 100644
--- a/GudhUI/model/Model.h
+++ b/GudhUI/model/Model.h
@@ -72,8 +72,8 @@ class CGAL_geometric_flag_complex_wrapper {
void maximal_face(std::vector<int> vertices) {
if (!load_only_points_) {
// std::cout << "size:" << vertices.size() << std::endl;
- for (int i = 0; i < vertices.size(); ++i)
- for (int j = i + 1; j < vertices.size(); ++j)
+ for (std::size_t i = 0; i < vertices.size(); ++i)
+ for (std::size_t j = i + 1; j < vertices.size(); ++j)
complex_.add_edge(Vertex_handle(vertices[i]), Vertex_handle(vertices[j]));
}
}
@@ -187,7 +187,7 @@ class Model {
}
void contract_edges(unsigned num_contractions) {
- Clock c;
+ Gudhi::Clock c;
Edge_contractor<Complex> contractor(complex_, num_contractions);
std::cout << "Time to simplify: " << c.num_seconds() << "s" << std::endl;
}
@@ -248,7 +248,7 @@ class Model {
unsigned num_simplices = 0;
int euler = 0;
int dimension = 0;
- Clock clock;
+ Gudhi::Clock clock;
for (const auto &s : complex_.complex_simplex_range()) {
num_simplices++;
dimension = (std::max)(s.dimension(), dimension);
@@ -271,7 +271,7 @@ class Model {
#ifdef _WIN32
std::cout << "Works only on linux x64 for the moment\n";
#else
- Clock clock;
+ Gudhi::Clock clock;
run_chomp();
clock.end();
#endif
diff --git a/GudhUI/utils/Critical_points.h b/GudhUI/utils/Critical_points.h
index 3021a5fe..2a18e079 100644
--- a/GudhUI/utils/Critical_points.h
+++ b/GudhUI/utils/Critical_points.h
@@ -106,6 +106,7 @@ template<typename SkBlComplex> class Critical_points {
return 0;
Edge_contractor<Complex> contractor(link, link.num_vertices() - 1);
+ (void)contractor;
if (link.num_connected_components() > 1)
// one than more CC -> not contractible
diff --git a/GudhUI/utils/Edge_contractor.h b/GudhUI/utils/Edge_contractor.h
index 45079a40..8a29ff4b 100644
--- a/GudhUI/utils/Edge_contractor.h
+++ b/GudhUI/utils/Edge_contractor.h
@@ -65,7 +65,7 @@ template<typename SkBlComplex> class Edge_contractor {
Placement_type operator()(const EdgeProfile& profile) const override {
std::vector<double> mid_coords(profile.p0().dimension(), 0);
- for (size_t i = 0; i < profile.p0().dimension(); ++i) {
+ for (int i = 0; i < profile.p0().dimension(); ++i) {
mid_coords[i] = (profile.p0()[i] + profile.p1()[i]) / 2.;
}
return Point(profile.p0().dimension(), mid_coords.begin(), mid_coords.end());
diff --git a/GudhUI/utils/Furthest_point_epsilon_net.h b/GudhUI/utils/Furthest_point_epsilon_net.h
index f2a216f6..98346daa 100644
--- a/GudhUI/utils/Furthest_point_epsilon_net.h
+++ b/GudhUI/utils/Furthest_point_epsilon_net.h
@@ -73,7 +73,7 @@ template<typename SkBlComplex> class Furthest_point_epsilon_net {
complex_(complex) {
if (!complex.empty()) {
init_filtration();
- for (int k = 2; k < net_filtration_.size(); ++k) {
+ for (std::size_t k = 2; k < net_filtration_.size(); ++k) {
update_radius_value(k);
}
}
diff --git a/GudhUI/utils/Is_manifold.h b/GudhUI/utils/Is_manifold.h
index 0640ea47..d0974463 100644
--- a/GudhUI/utils/Is_manifold.h
+++ b/GudhUI/utils/Is_manifold.h
@@ -77,6 +77,7 @@ template<typename SkBlComplex> class Is_manifold {
bool is_k_sphere(Vertex_handle v, int k) {
auto link = input_complex_.link(v);
Edge_contractor<Complex> contractor(link, link.num_vertices() - 1);
+ (void)contractor;
return (is_sphere_simplex(link) == k);
}
diff --git a/GudhUI/utils/Persistence_compute.h b/GudhUI/utils/Persistence_compute.h
index 97165490..2dc03c8e 100644
--- a/GudhUI/utils/Persistence_compute.h
+++ b/GudhUI/utils/Persistence_compute.h
@@ -29,6 +29,7 @@
#include <gudhi/Simplex_tree.h>
#include <gudhi/distance_functions.h>
#include <gudhi/Persistent_cohomology.h>
+#include <gudhi/Rips_complex.h>
#include <vector>
@@ -69,21 +70,23 @@ template<typename SkBlComplex> class Persistence_compute {
points.emplace_back(std::move(pt_to_add));
}
+ using Simplex_tree = Gudhi::Simplex_tree<>;
+ using Filtration_value = Simplex_tree::Filtration_value;
+ using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
+ using Field_Zp = Gudhi::persistent_cohomology::Field_Zp;
+ using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Field_Zp>;
- Graph_t prox_graph = compute_proximity_graph(points, params.threshold, euclidean_distance<Point_t>);
- Gudhi::Simplex_tree<> st;
- st.insert_graph(prox_graph);
- st.expansion(params.max_dim);
+ Rips_complex rips_complex(points, params.threshold, Euclidean_distance());
- Gudhi::persistent_cohomology::Persistent_cohomology< Gudhi::Simplex_tree<>,
- Gudhi::persistent_cohomology::Field_Zp > pcoh(st);
+ Simplex_tree st;
+ rips_complex.create_complex(st, params.max_dim);
+ Persistent_cohomology pcoh(st);
// initializes the coefficient field for homology
pcoh.init_coefficients(params.p);
// put params.min_pers
pcoh.compute_persistent_cohomology(params.min_pers);
stream << "persistence: \n";
stream << "p dimension birth death: \n";
-
pcoh.output_diagram(stream);
}
};
diff --git a/GudhUI/utils/Vertex_collapsor.h b/GudhUI/utils/Vertex_collapsor.h
index 2b36cb3a..568dab2f 100644
--- a/GudhUI/utils/Vertex_collapsor.h
+++ b/GudhUI/utils/Vertex_collapsor.h
@@ -81,6 +81,7 @@ template<typename SkBlComplex> class Vertex_collapsor {
if (link.is_cone()) return true;
if (link.num_connected_components() > 1) return false;
Edge_contractor<Complex> contractor(link, link.num_vertices() - 1);
+ (void)contractor;
return (link.num_vertices() == 1);
}
};
diff --git a/GudhUI/view/FirstCoordProjector.h b/GudhUI/view/FirstCoordProjector.h
index a4027b7f..1333f5d3 100644
--- a/GudhUI/view/FirstCoordProjector.h
+++ b/GudhUI/view/FirstCoordProjector.h
@@ -33,9 +33,11 @@ class FirstCoordProjector3D : public Projector3D {
Point_3 operator()(const Point& p) const {
if (p.dimension() >= 3)
- return Point_3(p.x(), p.y(), p.z());
+ return Point_3(p.x(), p.y(), p.z());
else if (p.dimension() >= 2)
- return Point_3(p.x(), p.y(), 0.0);
+ return Point_3(p.x(), p.y(), 0.0);
+ else
+ return Point_3(0.0, 0.0, 0.0);
}
};
diff --git a/GudhUI/view/Viewer.h b/GudhUI/view/Viewer.h
index 319c8e04..797ddc53 100644
--- a/GudhUI/view/Viewer.h
+++ b/GudhUI/view/Viewer.h
@@ -24,9 +24,6 @@
#ifndef VIEW_VIEWER_H_
#define VIEW_VIEWER_H_
-// Workaround for moc-qt4 not parsing boost headers
-#include <CGAL/config.h>
-
#include <QGLViewer/qglviewer.h>
#include <vector>
diff --git a/GudhUI/view/Viewer_instructor.h b/GudhUI/view/Viewer_instructor.h
index 1da28009..05c5c1fc 100644
--- a/GudhUI/view/Viewer_instructor.h
+++ b/GudhUI/view/Viewer_instructor.h
@@ -26,9 +26,6 @@
// todo do a viewer instructor that have directely a pointer to a QGLviewer and buffer ot not triangles
-// Workaround for moc-qt4 not parsing boost headers
-#include <CGAL/config.h>
-
#include <QFileDialog>
#include <QKeyEvent>
#include <QGLViewer/camera.h>