summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/test
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-18 14:21:31 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-18 14:21:31 +0000
commit56e89b6b7666dec86a70f6a30f08ef8b7960eb21 (patch)
treea43dd7705fcf7435df726e5bc5123662abc8ea4d /src/Alpha_complex/test
parent77b57ae69fa2042b652d91d8015c1d9533176090 (diff)
Moved alphashapedoc.off in data/points
Moved Delaunay triangulation OFF files read and write in src/common Delaunay triangulation OFF files read and write documentation, examples and tests git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@623 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e03902736a79436e97dbf77a88504f3faa8bd9c6
Diffstat (limited to 'src/Alpha_complex/test')
-rw-r--r--src/Alpha_complex/test/Alpha_complex_unit_test.cpp71
-rw-r--r--src/Alpha_complex/test/CMakeLists.txt2
-rw-r--r--src/Alpha_complex/test/README2
-rw-r--r--src/Alpha_complex/test/S4_100.off4
-rw-r--r--src/Alpha_complex/test/S8_10.off4
5 files changed, 22 insertions, 61 deletions
diff --git a/src/Alpha_complex/test/Alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_unit_test.cpp
index 38168f10..86d4d9c3 100644
--- a/src/Alpha_complex/test/Alpha_complex_unit_test.cpp
+++ b/src/Alpha_complex/test/Alpha_complex_unit_test.cpp
@@ -25,25 +25,10 @@
#include <boost/system/error_code.hpp>
#include <boost/chrono/thread_clock.hpp>
// to construct a Delaunay_triangulation from a OFF file
-#include "gudhi/Alpha_shapes/Delaunay_triangulation_off_io.h"
+#include "gudhi/Delaunay_triangulation_off_io.h"
#include "gudhi/Alpha_complex.h"
-// to construct a simplex_tree from Delaunay_triangulation
-#include "gudhi/graph_simplicial_complex.h"
-#include "gudhi/Simplex_tree.h"
-
-#include <CGAL/Delaunay_triangulation.h>
-#include <CGAL/Epick_d.h>
-#include <CGAL/point_generators_d.h>
-#include <CGAL/algorithm.h>
-#include <CGAL/assertions.h>
-
-#include <iostream>
-#include <iterator>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
+#include <cmath> // float comparison
// Use dynamic_dimension_tag for the user to be able to set dimension
typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > K;
@@ -51,7 +36,7 @@ typedef CGAL::Delaunay_triangulation<K> T;
// The triangulation uses the default instantiation of the
// TriangulationDataStructure template parameter
-BOOST_AUTO_TEST_CASE( OFF_file ) {
+BOOST_AUTO_TEST_CASE( S4_100_OFF_file ) {
// ----------------------------------------------------------------------------
//
// Init of an alpha-complex from a OFF file
@@ -66,61 +51,37 @@ BOOST_AUTO_TEST_CASE( OFF_file ) {
std::cout << "alpha_complex_from_file.dimension()=" << alpha_complex_from_file.dimension() << std::endl;
BOOST_CHECK(alpha_complex_from_file.dimension() == DIMENSION);
- const double FILTRATION = 0.0;
- std::cout << "alpha_complex_from_file.filtration()=" << alpha_complex_from_file.filtration() << std::endl;
- BOOST_CHECK(alpha_complex_from_file.filtration() == FILTRATION);
-
const int NUMBER_OF_VERTICES = 100;
std::cout << "alpha_complex_from_file.num_vertices()=" << alpha_complex_from_file.num_vertices() << std::endl;
BOOST_CHECK(alpha_complex_from_file.num_vertices() == NUMBER_OF_VERTICES);
- const int NUMBER_OF_SIMPLICES = 6779;
+ const int NUMBER_OF_SIMPLICES = 6879;
std::cout << "alpha_complex_from_file.num_simplices()=" << alpha_complex_from_file.num_simplices() << std::endl;
BOOST_CHECK(alpha_complex_from_file.num_simplices() == NUMBER_OF_SIMPLICES);
}
-BOOST_AUTO_TEST_CASE( Delaunay_triangulation ) {
+BOOST_AUTO_TEST_CASE( S8_10_OFF_file ) {
// ----------------------------------------------------------------------------
//
- // Init of an alpha-complex from a Delaunay triangulation
+ // Init of an alpha-complex from a OFF file
//
// ----------------------------------------------------------------------------
- T dt;
std::string off_file_name("S8_10.off");
std::cout << "========== OFF FILE NAME = " << off_file_name << " ==========" << std::endl;
- Gudhi::alphacomplex::Delaunay_triangulation_off_reader<T> off_reader(off_file_name, dt);
- std::cout << "off_reader.is_valid()=" << off_reader.is_valid() << std::endl;
- BOOST_CHECK(off_reader.is_valid());
-
- const int NUMBER_OF_VERTICES = 10;
- std::cout << "dt.number_of_vertices()=" << dt.number_of_vertices() << std::endl;
- BOOST_CHECK(dt.number_of_vertices() == NUMBER_OF_VERTICES);
-
- const int NUMBER_OF_FULL_CELLS = 30;
- std::cout << "dt.number_of_full_cells()=" << dt.number_of_full_cells() << std::endl;
- BOOST_CHECK(dt.number_of_full_cells() == NUMBER_OF_FULL_CELLS);
-
- const int NUMBER_OF_FINITE_FULL_CELLS = 6;
- std::cout << "dt.number_of_finite_full_cells()=" << dt.number_of_finite_full_cells() << std::endl;
- BOOST_CHECK(dt.number_of_finite_full_cells() == NUMBER_OF_FINITE_FULL_CELLS);
-
- Gudhi::alphacomplex::Alpha_complex alpha_complex_from_dt(dt);
+ Gudhi::alphacomplex::Alpha_complex alpha_complex_from_file(off_file_name);
const int DIMENSION = 8;
- std::cout << "alpha_complex_from_dt.dimension()=" << alpha_complex_from_dt.dimension() << std::endl;
- BOOST_CHECK(alpha_complex_from_dt.dimension() == DIMENSION);
-
- const double FILTRATION = 0.0;
- std::cout << "alpha_complex_from_dt.filtration()=" << alpha_complex_from_dt.filtration() << std::endl;
- BOOST_CHECK(alpha_complex_from_dt.filtration() == FILTRATION);
+ std::cout << "alpha_complex_from_file.dimension()=" << alpha_complex_from_file.dimension() << std::endl;
+ BOOST_CHECK(alpha_complex_from_file.dimension() == DIMENSION);
- std::cout << "alpha_complex_from_dt.num_vertices()=" << alpha_complex_from_dt.num_vertices() << std::endl;
- BOOST_CHECK(alpha_complex_from_dt.num_vertices() == NUMBER_OF_VERTICES);
+ const int NUMBER_OF_VERTICES = 10;
+ std::cout << "alpha_complex_from_file.num_vertices()=" << alpha_complex_from_file.num_vertices() << std::endl;
+ BOOST_CHECK(alpha_complex_from_file.num_vertices() == NUMBER_OF_VERTICES);
- const int NUMBER_OF_SIMPLICES = 997;
- std::cout << "alpha_complex_from_dt.num_simplices()=" << alpha_complex_from_dt.num_simplices() << std::endl;
- BOOST_CHECK(alpha_complex_from_dt.num_simplices() == NUMBER_OF_SIMPLICES);
-}
+ const int NUMBER_OF_SIMPLICES = 1007;
+ std::cout << "alpha_complex_from_file.num_simplices()=" << alpha_complex_from_file.num_simplices() << std::endl;
+ BOOST_CHECK(alpha_complex_from_file.num_simplices() == NUMBER_OF_SIMPLICES);
+}
diff --git a/src/Alpha_complex/test/CMakeLists.txt b/src/Alpha_complex/test/CMakeLists.txt
index 72e8390a..4fe69ce5 100644
--- a/src/Alpha_complex/test/CMakeLists.txt
+++ b/src/Alpha_complex/test/CMakeLists.txt
@@ -15,7 +15,7 @@ if(CGAL_FOUND)
include( ${EIGEN3_USE_FILE} )
include_directories (BEFORE "../../include")
- add_definitions(-DDEBUG_TRACES)
+ #add_definitions(-DDEBUG_TRACES)
add_executable ( AlphaComplexUnitTest Alpha_complex_unit_test.cpp )
target_link_libraries(AlphaComplexUnitTest ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
add_test(AlphaComplexUnitTest ${CMAKE_CURRENT_BINARY_DIR}/AlphaComplexUnitTest)
diff --git a/src/Alpha_complex/test/README b/src/Alpha_complex/test/README
index 244a2b84..45b87d91 100644
--- a/src/Alpha_complex/test/README
+++ b/src/Alpha_complex/test/README
@@ -7,6 +7,6 @@ make
To launch with details:
***********************
-./AlphaShapesUnitTest --report_level=detailed --log_level=all
+./AlphaComplexUnitTest --report_level=detailed --log_level=all
==> echo $? returns 0 in case of success (non-zero otherwise)
diff --git a/src/Alpha_complex/test/S4_100.off b/src/Alpha_complex/test/S4_100.off
index 0a5dc58c..cd017e12 100644
--- a/src/Alpha_complex/test/S4_100.off
+++ b/src/Alpha_complex/test/S4_100.off
@@ -1,5 +1,5 @@
-OFF
-100 0 0
+nOFF
+4 100 0 0
0.562921 -0.735261 -0.256472 0.277007
-0.803733 -0.0527915 -0.315125 0.501918
-0.24946 -0.354982 -0.410773 -0.801887
diff --git a/src/Alpha_complex/test/S8_10.off b/src/Alpha_complex/test/S8_10.off
index 1d67e10f..4e147c44 100644
--- a/src/Alpha_complex/test/S8_10.off
+++ b/src/Alpha_complex/test/S8_10.off
@@ -1,5 +1,5 @@
-OFF
-10 0 0
+nOFF
+8 10 0 0
0.440036 -0.574754 -0.200485 0.216537 -0.501251 -0.0329236 -0.196529 0.313023
-0.129367 -0.184089 -0.213021 -0.415848 0.783529 -0.0438025 0.317256 0.120749
0.132429 0.683748 -0.124536 -0.166133 -0.540695 -0.0887576 0.390234 -0.139031