summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-04-27 10:24:05 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-04-27 10:24:05 +0000
commiteaedaf52122a397f35fb75df93f83ae9ffdceb7c (patch)
treed54ae253915affc0604583b6bf7176f45c5ed314 /src
parentd3cef9245dcff1ea585142ef0b711bb35b6f9338 (diff)
Struggled with CMake...
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@579 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 38b558196806b226cba5e1ef30abb927619bbe33
Diffstat (limited to 'src')
-rw-r--r--src/Witness_complex/example/CMakeLists.txt48
-rw-r--r--src/Witness_complex/include/gudhi/Witness_complex.h42
2 files changed, 59 insertions, 31 deletions
diff --git a/src/Witness_complex/example/CMakeLists.txt b/src/Witness_complex/example/CMakeLists.txt
index 51f7976b..14d23551 100644
--- a/src/Witness_complex/example/CMakeLists.txt
+++ b/src/Witness_complex/example/CMakeLists.txt
@@ -1,23 +1,41 @@
cmake_minimum_required(VERSION 2.6)
project(GUDHIWitnessComplex)
+#cmake -DCGAL_DIR=~/GitDrive/CGAL/ ../../..
-add_executable ( simple_witness_complex simple_witness_complex.cpp )
-add_test(simple_witness_complex ${CMAKE_CURRENT_BINARY_DIR}/simple_witness_complex)
+#if (CGAL_FOUND)
+ #message(STATUS "CGAL version: ${CGAL_VERSION}.")
+ #include( ${CGAL_USE_FILE} )
-add_executable( witness_complex_from_file witness_complex_from_file.cpp )
-add_test( witness_complex_from_bunny &{CMAKE_CURRENT_BINARY_DIR}/witness_complex_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000 )
+ #find_package(Eigen3 3.1.0)
+ #include( ${EIGEN3_USE_FILE} )
-add_executable( witness_complex_from_off witness_complex_from_off.cpp )
+ #INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIR})
+ #INCLUDE_DIRECTORIES(${CGAL_INCLUDE_DIRS})
+ add_executable ( simple_witness_complex simple_witness_complex.cpp )
+ add_test(simple_witness_complex ${CMAKE_CURRENT_BINARY_DIR}/simple_witness_complex)
-add_executable( witness_complex_from_wl_matrix witness_complex_from_wl_matrix.cpp )
+ #add_executable( witness_complex_from_file witness_complex_from_file.cpp )
+ #target_link_libraries(witness_complex_from_file ${EIGEN3_LIBRARIES} ${CGAL_LIBRARY})
+ #add_test( witness_complex_from_bunny &{CMAKE_CURRENT_BINARY_DIR}/witness_complex_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000 100)
+
+ add_executable( witness_complex_from_off witness_complex_from_off.cpp )
+
+ add_executable( witness_complex_from_wl_matrix witness_complex_from_wl_matrix.cpp )
+#endif()
# An example with Simplex-tree using CGAL alpha_shapes_3
-#if(GMP_FOUND AND CGAL_FOUND)
-# message("CGAL_lib = ${CGAL_LIBRARIES_DIR}")
-# message("GMP_LIBRARIES = ${GMP_LIBRARIES}")
-# INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR})
-# INCLUDE_DIRECTORIES(${CGAL_INCLUDE_DIRS})
-# add_executable ( simplex_tree_from_alpha_shapes_3 simplex_tree_from_alpha_shapes_3.cpp )
-# target_link_libraries(simplex_tree_from_alpha_shapes_3 ${GMP_LIBRARIES} ${CGAL_LIBRARY})
-# add_test(simplex_tree_from_alpha_shapes_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_alpha_shapes_3 ${CMAKE_SOURCE_DIR}/data/points/bunny_5000)
-#endif()
+
+include( ${CGAL_USE_FILE} )
+find_package(Eigen3 3.1.0)
+if(GMP_FOUND AND CGAL_FOUND)
+ message("CGAL_lib = ${CGAL_LIBRARIES_DIR}")
+ message("GMP_LIBRARIES = ${GMP_LIBRARIES}")
+ message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
+ #message("EIGEN3_LIBRARIES = ${EIGEN3_LIBRARIES}")
+ INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS})
+ INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${CGAL_INCLUDE_DIRS})
+ add_executable (witness_complex_from_file witness_complex_from_file.cpp )
+ target_link_libraries(witness_complex_from_file ${GMP_LIBRARIES} ${EIGEN3_LIBRARIES} ${CGAL_LIBRARY})
+ add_test(witness_complex_from_file ${CMAKE_CURRENT_BINARY_DIR}/witness_complex_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000 100)
+endif()
diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h
index c633691b..3c030c45 100644
--- a/src/Witness_complex/include/gudhi/Witness_complex.h
+++ b/src/Witness_complex/include/gudhi/Witness_complex.h
@@ -38,6 +38,13 @@
#include <ctime>
#include <iostream>
+// Needed for nearest neighbours
+//#include <CGAL/Delaunay_triangulation.h>
+#include <CGAL/Epick_d.h>
+#include <CGAL/K_neighbor_search.h>
+#include <CGAL/Search_traits_d.h>
+
+// Needed for the adjacency graph in bad link search
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>
@@ -477,9 +484,9 @@ private:
int chosen_landmark = rand()%nbP;
double curr_dist;
- int j;
- int temp_swap_int;
- double temp_swap_double;
+ //int j;
+ //int temp_swap_int;
+ //double temp_swap_double;
for (current_number_of_landmarks = 0; current_number_of_landmarks != nbL; current_number_of_landmarks++)
@@ -508,7 +515,7 @@ private:
wit_land_dist[i].push_back(curr_dist);
WL[i].push_back(current_number_of_landmarks);
//std::cout << "Push't back\n";
- j = current_number_of_landmarks;
+ //j = current_number_of_landmarks;
//std::cout << "First half complete\n";
//std::cout << "result WL="; print_vvector(WL);
//std::cout << "result WLD="; print_vvector(wit_land_dist);
@@ -517,21 +524,24 @@ private:
}
for (int i = 0; i < nbP; i++)
{
- // sort the closest landmark vector for every witness
sort(WL[i].begin(), WL[i].end(), [&](int j1, int j2){return wit_land_dist[i][j1] < wit_land_dist[i][j2];});
- /*
- temp_swap_int = WL[i][j];
- WL[i][j] = WL[i][j-1];
- WL[i][j-1] = temp_swap_int;
- temp_swap_double = wit_land_dist[i][j];
- wit_land_dist[i][j] = wit_land_dist[i][j-1];
- wit_land_dist[i][j-1] = temp_swap_double;
- --j;
- */
}
//std::cout << endl;
}
+ /** \brief Construct the matrix |W|x(D+1) of D+1 closest landmarks
+ * where W is the set of witnesses and D is the ambient dimension
+ */
+ template <typename KNearestNeighbours>
+ void nearest_landmarks(Point_Vector &W, std::unordered_set<int> &L, KNearestNeighbours &WL)
+ {
+ int D = W[0].size();
+
+ }
+
+ /** \brief Search and output links around vertices that are not pseudomanifolds
+ *
+ */
void write_bad_links(std::ofstream& out_file)
{
out_file << "Bad links list\n";
@@ -565,14 +575,14 @@ private:
//out_file << "Number of bad links: " << count << "/" << root()->size();
//std::cout << "Number of bad links: " << count << "/" << root()->size() << std::endl;
nc = nbL;
- for (int i = 0; i != count_good.size(); i++)
+ for (unsigned int i = 0; i != count_good.size(); i++)
{
out_file << "count_good[" << i << "] = " << count_good[i] << std::endl;
nc -= count_good[i];
if (count_good[i] != 0)
std::cout << "count_good[" << i << "] = " << count_good[i] << std::endl;
}
- for (int i = 0; i != count_bad.size(); i++)
+ for (unsigned int i = 0; i != count_bad.size(); i++)
{
out_file << "count_bad[" << i << "] = " << count_bad[i] << std::endl;
nc -= count_bad[i];