From a44c1b5d51b3ecfd1a1ef1cacb029f52fbc3de49 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau Date: Fri, 13 Jan 2023 10:21:57 +0100 Subject: Split Delaunay complex in 4 executables to relieve windows CI --- src/Alpha_complex/test/CMakeLists.txt | 20 +++++-- .../Delaunay_complex_Epeck_dynamic_unit_test.cpp | 57 ++++++++++++++++++ .../Delaunay_complex_Epeck_static_unit_test.cpp | 57 ++++++++++++++++++ .../Delaunay_complex_Epick_dynamic_unit_test.cpp | 57 ++++++++++++++++++ .../Delaunay_complex_Epick_static_unit_test.cpp | 57 ++++++++++++++++++ .../test/Delaunay_complex_unit_test.cpp | 68 ---------------------- 6 files changed, 244 insertions(+), 72 deletions(-) create mode 100644 src/Alpha_complex/test/Delaunay_complex_Epeck_dynamic_unit_test.cpp create mode 100644 src/Alpha_complex/test/Delaunay_complex_Epeck_static_unit_test.cpp create mode 100644 src/Alpha_complex/test/Delaunay_complex_Epick_dynamic_unit_test.cpp create mode 100644 src/Alpha_complex/test/Delaunay_complex_Epick_static_unit_test.cpp delete mode 100644 src/Alpha_complex/test/Delaunay_complex_unit_test.cpp diff --git a/src/Alpha_complex/test/CMakeLists.txt b/src/Alpha_complex/test/CMakeLists.txt index dd2c235f..7838a15d 100644 --- a/src/Alpha_complex/test/CMakeLists.txt +++ b/src/Alpha_complex/test/CMakeLists.txt @@ -10,17 +10,29 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) target_link_libraries(Alpha_complex_test_unit ${CGAL_LIBRARY}) add_executable ( Alpha_complex_dim3_test_unit Alpha_complex_dim3_unit_test.cpp ) target_link_libraries(Alpha_complex_dim3_test_unit ${CGAL_LIBRARY}) - add_executable ( Delaunay_complex_test_unit Delaunay_complex_unit_test.cpp ) - target_link_libraries(Delaunay_complex_test_unit ${CGAL_LIBRARY}) + add_executable ( Delaunay_complex_Epeck_dynamic_test_unit Delaunay_complex_Epeck_dynamic_unit_test.cpp ) + target_link_libraries(Delaunay_complex_Epeck_dynamic_test_unit ${CGAL_LIBRARY}) + add_executable ( Delaunay_complex_Epeck_static_test_unit Delaunay_complex_Epeck_static_unit_test.cpp ) + target_link_libraries(Delaunay_complex_Epeck_static_test_unit ${CGAL_LIBRARY}) + add_executable ( Delaunay_complex_Epick_dynamic_test_unit Delaunay_complex_Epick_dynamic_unit_test.cpp ) + target_link_libraries(Delaunay_complex_Epick_dynamic_test_unit ${CGAL_LIBRARY}) + add_executable ( Delaunay_complex_Epick_static_test_unit Delaunay_complex_Epick_static_unit_test.cpp ) + target_link_libraries(Delaunay_complex_Epick_static_test_unit ${CGAL_LIBRARY}) if (TBB_FOUND) target_link_libraries(Alpha_complex_test_unit ${TBB_LIBRARIES}) target_link_libraries(Alpha_complex_dim3_test_unit ${TBB_LIBRARIES}) - target_link_libraries(Delaunay_complex_test_unit ${TBB_LIBRARIES}) + target_link_libraries(Delaunay_complex_Epeck_dynamic_test_unit ${TBB_LIBRARIES}) + target_link_libraries(Delaunay_complex_Epeck_static_test_unit ${TBB_LIBRARIES}) + target_link_libraries(Delaunay_complex_Epick_dynamic_test_unit ${TBB_LIBRARIES}) + target_link_libraries(Delaunay_complex_Epick_static_test_unit ${TBB_LIBRARIES}) endif() gudhi_add_boost_test(Alpha_complex_test_unit) gudhi_add_boost_test(Alpha_complex_dim3_test_unit) - gudhi_add_boost_test(Delaunay_complex_test_unit) + gudhi_add_boost_test(Delaunay_complex_Epeck_dynamic_test_unit) + gudhi_add_boost_test(Delaunay_complex_Epeck_static_test_unit) + gudhi_add_boost_test(Delaunay_complex_Epick_dynamic_test_unit) + gudhi_add_boost_test(Delaunay_complex_Epick_static_test_unit) endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) diff --git a/src/Alpha_complex/test/Delaunay_complex_Epeck_dynamic_unit_test.cpp b/src/Alpha_complex/test/Delaunay_complex_Epeck_dynamic_unit_test.cpp new file mode 100644 index 00000000..575a36fc --- /dev/null +++ b/src/Alpha_complex/test/Delaunay_complex_Epeck_dynamic_unit_test.cpp @@ -0,0 +1,57 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2020 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "delaunay_complex_exact_kernel_dynamic" +#include + +#include + +#include +#include // NaN +#include + +#include +// to construct a simplex_tree from Delaunay_triangulation +#include +#include +#include +#include + +// Use dynamic_dimension_tag for the user to be able to set dimension +typedef CGAL::Epeck_d< CGAL::Dynamic_dimension_tag > Exact_kernel_d; + +using Simplex_tree = Gudhi::Simplex_tree<>; +using Simplex_handle = Simplex_tree::Simplex_handle; + +BOOST_AUTO_TEST_CASE(Delaunay_complex_exact_kernel_dynamic_simplices_comparison) { + std::cout << "*****************************************************************************************************"; + using Point = typename Exact_kernel_d::Point_d; + std::vector points; + // 50 points on a 4-sphere + points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); + + Gudhi::alpha_complex::Alpha_complex alpha_complex(points); + + // Alpha complex + Simplex_tree stree_from_alpha_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); + + // Delaunay complex + Simplex_tree stree_from_delaunay_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); + + // Check all the simplices from alpha complex are in the Delaunay complex + for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { + Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); + BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); + BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); + } +} diff --git a/src/Alpha_complex/test/Delaunay_complex_Epeck_static_unit_test.cpp b/src/Alpha_complex/test/Delaunay_complex_Epeck_static_unit_test.cpp new file mode 100644 index 00000000..fd69a81e --- /dev/null +++ b/src/Alpha_complex/test/Delaunay_complex_Epeck_static_unit_test.cpp @@ -0,0 +1,57 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2020 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "delaunay_complex_exact_kernel_static" +#include + +#include + +#include +#include // NaN +#include + +#include +// to construct a simplex_tree from Delaunay_triangulation +#include +#include +#include +#include + +// Use static dimension_tag for the user not to be able to set dimension +typedef CGAL::Epeck_d< CGAL::Dimension_tag<5> > Exact_kernel_s; + +using Simplex_tree = Gudhi::Simplex_tree<>; +using Simplex_handle = Simplex_tree::Simplex_handle; + +BOOST_AUTO_TEST_CASE(Delaunay_complex_exact_kernel_static_simplices_comparison) { + std::cout << "*****************************************************************************************************"; + using Point = typename Exact_kernel_s::Point_d; + std::vector points; + // 50 points on a 4-sphere + points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); + + Gudhi::alpha_complex::Alpha_complex alpha_complex(points); + + // Alpha complex + Simplex_tree stree_from_alpha_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); + + // Delaunay complex + Simplex_tree stree_from_delaunay_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); + + // Check all the simplices from alpha complex are in the Delaunay complex + for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { + Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); + BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); + BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); + } +} diff --git a/src/Alpha_complex/test/Delaunay_complex_Epick_dynamic_unit_test.cpp b/src/Alpha_complex/test/Delaunay_complex_Epick_dynamic_unit_test.cpp new file mode 100644 index 00000000..e04d86bb --- /dev/null +++ b/src/Alpha_complex/test/Delaunay_complex_Epick_dynamic_unit_test.cpp @@ -0,0 +1,57 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2020 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "delaunay_complex_inexact_kernel_dynamic" +#include + +#include + +#include +#include // NaN +#include + +#include +// to construct a simplex_tree from Delaunay_triangulation +#include +#include +#include +#include + +// Use dynamic_dimension_tag for the user to be able to set dimension +typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Inexact_kernel_d; + +using Simplex_tree = Gudhi::Simplex_tree<>; +using Simplex_handle = Simplex_tree::Simplex_handle; + +BOOST_AUTO_TEST_CASE(Delaunay_complex_inexact_kernel_dynamic_simplices_comparison) { + std::cout << "*****************************************************************************************************"; + using Point = typename Inexact_kernel_d::Point_d; + std::vector points; + // 50 points on a 4-sphere + points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); + + Gudhi::alpha_complex::Alpha_complex alpha_complex(points); + + // Alpha complex + Simplex_tree stree_from_alpha_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); + + // Delaunay complex + Simplex_tree stree_from_delaunay_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); + + // Check all the simplices from alpha complex are in the Delaunay complex + for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { + Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); + BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); + BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); + } +} diff --git a/src/Alpha_complex/test/Delaunay_complex_Epick_static_unit_test.cpp b/src/Alpha_complex/test/Delaunay_complex_Epick_static_unit_test.cpp new file mode 100644 index 00000000..6bd2a72c --- /dev/null +++ b/src/Alpha_complex/test/Delaunay_complex_Epick_static_unit_test.cpp @@ -0,0 +1,57 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2020 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "delaunay_complex_inexact_kernel_static" +#include + +#include + +#include +#include // NaN +#include + +#include +// to construct a simplex_tree from Delaunay_triangulation +#include +#include +#include +#include + +// Use static dimension_tag for the user not to be able to set dimension +typedef CGAL::Epick_d< CGAL::Dimension_tag<5> > Inexact_kernel_s; + +using Simplex_tree = Gudhi::Simplex_tree<>; +using Simplex_handle = Simplex_tree::Simplex_handle; + +BOOST_AUTO_TEST_CASE(Delaunay_complex_inexact_kernel_static_simplices_comparison) { + std::cout << "*****************************************************************************************************"; + using Point = typename Inexact_kernel_s::Point_d; + std::vector points; + // 50 points on a 4-sphere + points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); + + Gudhi::alpha_complex::Alpha_complex alpha_complex(points); + + // Alpha complex + Simplex_tree stree_from_alpha_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); + + // Delaunay complex + Simplex_tree stree_from_delaunay_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); + + // Check all the simplices from alpha complex are in the Delaunay complex + for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { + Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); + BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); + BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); + } +} diff --git a/src/Alpha_complex/test/Delaunay_complex_unit_test.cpp b/src/Alpha_complex/test/Delaunay_complex_unit_test.cpp deleted file mode 100644 index c1cc1fab..00000000 --- a/src/Alpha_complex/test/Delaunay_complex_unit_test.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. - * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. - * Author(s): Vincent Rouvreau - * - * Copyright (C) 2020 Inria - * - * Modification(s): - * - YYYY/MM Author: Description of the modification - */ - -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE "delaunay_complex" -#include -#include - -#include -#include - -#include -#include // NaN -#include - -#include -// to construct a simplex_tree from Delaunay_triangulation -#include -#include -#include -#include - -// Use dynamic_dimension_tag for the user to be able to set dimension -typedef CGAL::Epeck_d< CGAL::Dynamic_dimension_tag > Exact_kernel_d; -// Use static dimension_tag for the user not to be able to set dimension -typedef CGAL::Epeck_d< CGAL::Dimension_tag<5> > Exact_kernel_s; -// Use dynamic_dimension_tag for the user to be able to set dimension -typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Inexact_kernel_d; -// Use static dimension_tag for the user not to be able to set dimension -typedef CGAL::Epick_d< CGAL::Dimension_tag<5> > Inexact_kernel_s; -// The triangulation uses the default instantiation of the TriangulationDataStructure template parameter - -typedef boost::mpl::list list_of_kernel_variants; - -using Simplex_tree = Gudhi::Simplex_tree<>; -using Simplex_handle = Simplex_tree::Simplex_handle; - -BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_from_OFF_file, TestedKernel, list_of_kernel_variants) { - std::cout << "*****************************************************************************************************"; - using Point = typename TestedKernel::Point_d; - std::vector points; - // 50 points on a 4-sphere - points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); - - Gudhi::alpha_complex::Alpha_complex alpha_complex(points); - - // Alpha complex - Simplex_tree stree_from_alpha_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); - - // Delaunay complex - Simplex_tree stree_from_delaunay_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); - - // Check all the simplices from alpha complex are in the Delaunay complex - for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { - Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); - BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); - BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); - } -} -- cgit v1.2.3 From d35581357525d02e3126e9fe901904cc764e1f5c Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau Date: Fri, 13 Jan 2023 14:31:59 +0100 Subject: code review: was not DRY at all --- .../Delaunay_complex_Epeck_dynamic_unit_test.cpp | 41 ++---------------- .../Delaunay_complex_Epeck_static_unit_test.cpp | 41 ++---------------- .../Delaunay_complex_Epick_dynamic_unit_test.cpp | 41 ++---------------- .../Delaunay_complex_Epick_static_unit_test.cpp | 41 ++---------------- .../test/Delaunay_complex_unit_test.h | 49 ++++++++++++++++++++++ 5 files changed, 61 insertions(+), 152 deletions(-) create mode 100644 src/Alpha_complex/test/Delaunay_complex_unit_test.h diff --git a/src/Alpha_complex/test/Delaunay_complex_Epeck_dynamic_unit_test.cpp b/src/Alpha_complex/test/Delaunay_complex_Epeck_dynamic_unit_test.cpp index 575a36fc..afe065fc 100644 --- a/src/Alpha_complex/test/Delaunay_complex_Epeck_dynamic_unit_test.cpp +++ b/src/Alpha_complex/test/Delaunay_complex_Epeck_dynamic_unit_test.cpp @@ -14,44 +14,9 @@ #include -#include -#include // NaN -#include - -#include -// to construct a simplex_tree from Delaunay_triangulation -#include -#include -#include -#include - -// Use dynamic_dimension_tag for the user to be able to set dimension -typedef CGAL::Epeck_d< CGAL::Dynamic_dimension_tag > Exact_kernel_d; - -using Simplex_tree = Gudhi::Simplex_tree<>; -using Simplex_handle = Simplex_tree::Simplex_handle; +#include "Delaunay_complex_unit_test.h" BOOST_AUTO_TEST_CASE(Delaunay_complex_exact_kernel_dynamic_simplices_comparison) { - std::cout << "*****************************************************************************************************"; - using Point = typename Exact_kernel_d::Point_d; - std::vector points; - // 50 points on a 4-sphere - points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); - - Gudhi::alpha_complex::Alpha_complex alpha_complex(points); - - // Alpha complex - Simplex_tree stree_from_alpha_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); - - // Delaunay complex - Simplex_tree stree_from_delaunay_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); - - // Check all the simplices from alpha complex are in the Delaunay complex - for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { - Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); - BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); - BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); - } + // Use dynamic_dimension_tag for the user to be able to set dimension + compare_delaunay_complex_simplices>(); } diff --git a/src/Alpha_complex/test/Delaunay_complex_Epeck_static_unit_test.cpp b/src/Alpha_complex/test/Delaunay_complex_Epeck_static_unit_test.cpp index fd69a81e..c84766ea 100644 --- a/src/Alpha_complex/test/Delaunay_complex_Epeck_static_unit_test.cpp +++ b/src/Alpha_complex/test/Delaunay_complex_Epeck_static_unit_test.cpp @@ -14,44 +14,9 @@ #include -#include -#include // NaN -#include - -#include -// to construct a simplex_tree from Delaunay_triangulation -#include -#include -#include -#include - -// Use static dimension_tag for the user not to be able to set dimension -typedef CGAL::Epeck_d< CGAL::Dimension_tag<5> > Exact_kernel_s; - -using Simplex_tree = Gudhi::Simplex_tree<>; -using Simplex_handle = Simplex_tree::Simplex_handle; +#include "Delaunay_complex_unit_test.h" BOOST_AUTO_TEST_CASE(Delaunay_complex_exact_kernel_static_simplices_comparison) { - std::cout << "*****************************************************************************************************"; - using Point = typename Exact_kernel_s::Point_d; - std::vector points; - // 50 points on a 4-sphere - points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); - - Gudhi::alpha_complex::Alpha_complex alpha_complex(points); - - // Alpha complex - Simplex_tree stree_from_alpha_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); - - // Delaunay complex - Simplex_tree stree_from_delaunay_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); - - // Check all the simplices from alpha complex are in the Delaunay complex - for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { - Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); - BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); - BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); - } + // Use static dimension_tag for the user not to be able to set dimension + compare_delaunay_complex_simplices >>(); } diff --git a/src/Alpha_complex/test/Delaunay_complex_Epick_dynamic_unit_test.cpp b/src/Alpha_complex/test/Delaunay_complex_Epick_dynamic_unit_test.cpp index e04d86bb..956bab41 100644 --- a/src/Alpha_complex/test/Delaunay_complex_Epick_dynamic_unit_test.cpp +++ b/src/Alpha_complex/test/Delaunay_complex_Epick_dynamic_unit_test.cpp @@ -14,44 +14,9 @@ #include -#include -#include // NaN -#include - -#include -// to construct a simplex_tree from Delaunay_triangulation -#include -#include -#include -#include - -// Use dynamic_dimension_tag for the user to be able to set dimension -typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Inexact_kernel_d; - -using Simplex_tree = Gudhi::Simplex_tree<>; -using Simplex_handle = Simplex_tree::Simplex_handle; +#include "Delaunay_complex_unit_test.h" BOOST_AUTO_TEST_CASE(Delaunay_complex_inexact_kernel_dynamic_simplices_comparison) { - std::cout << "*****************************************************************************************************"; - using Point = typename Inexact_kernel_d::Point_d; - std::vector points; - // 50 points on a 4-sphere - points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); - - Gudhi::alpha_complex::Alpha_complex alpha_complex(points); - - // Alpha complex - Simplex_tree stree_from_alpha_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); - - // Delaunay complex - Simplex_tree stree_from_delaunay_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); - - // Check all the simplices from alpha complex are in the Delaunay complex - for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { - Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); - BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); - BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); - } + // Use dynamic_dimension_tag for the user to be able to set dimension + compare_delaunay_complex_simplices>(); } diff --git a/src/Alpha_complex/test/Delaunay_complex_Epick_static_unit_test.cpp b/src/Alpha_complex/test/Delaunay_complex_Epick_static_unit_test.cpp index 6bd2a72c..a401f09e 100644 --- a/src/Alpha_complex/test/Delaunay_complex_Epick_static_unit_test.cpp +++ b/src/Alpha_complex/test/Delaunay_complex_Epick_static_unit_test.cpp @@ -14,44 +14,9 @@ #include -#include -#include // NaN -#include - -#include -// to construct a simplex_tree from Delaunay_triangulation -#include -#include -#include -#include - -// Use static dimension_tag for the user not to be able to set dimension -typedef CGAL::Epick_d< CGAL::Dimension_tag<5> > Inexact_kernel_s; - -using Simplex_tree = Gudhi::Simplex_tree<>; -using Simplex_handle = Simplex_tree::Simplex_handle; +#include "Delaunay_complex_unit_test.h" BOOST_AUTO_TEST_CASE(Delaunay_complex_inexact_kernel_static_simplices_comparison) { - std::cout << "*****************************************************************************************************"; - using Point = typename Inexact_kernel_s::Point_d; - std::vector points; - // 50 points on a 4-sphere - points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); - - Gudhi::alpha_complex::Alpha_complex alpha_complex(points); - - // Alpha complex - Simplex_tree stree_from_alpha_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); - - // Delaunay complex - Simplex_tree stree_from_delaunay_complex; - BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); - - // Check all the simplices from alpha complex are in the Delaunay complex - for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { - Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); - BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); - BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); - } + // Use static dimension_tag for the user not to be able to set dimension + compare_delaunay_complex_simplices >>(); } diff --git a/src/Alpha_complex/test/Delaunay_complex_unit_test.h b/src/Alpha_complex/test/Delaunay_complex_unit_test.h new file mode 100644 index 00000000..e9a73f62 --- /dev/null +++ b/src/Alpha_complex/test/Delaunay_complex_unit_test.h @@ -0,0 +1,49 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2020 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#include +#include // NaN +#include + +#include +// to construct a simplex_tree from Delaunay_triangulation +#include +#include +#include +#include + +using Simplex_tree = Gudhi::Simplex_tree<>; +using Simplex_handle = Simplex_tree::Simplex_handle; + +template +void compare_delaunay_complex_simplices() { + std::cout << "*****************************************************************************************************"; + using Point = typename CGAL_kernel::Point_d; + std::vector points; + // 50 points on a 4-sphere + points = Gudhi::generate_points_on_sphere_d(10, 5, 1.); + + Gudhi::alpha_complex::Alpha_complex alpha_complex(points); + + // Alpha complex + Simplex_tree stree_from_alpha_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_alpha_complex)); + + // Delaunay complex + Simplex_tree stree_from_delaunay_complex; + BOOST_CHECK(alpha_complex.create_complex(stree_from_delaunay_complex, 0., false, true)); + + // Check all the simplices from alpha complex are in the Delaunay complex + for (auto f_simplex : stree_from_alpha_complex.complex_simplex_range()) { + Simplex_handle sh = stree_from_delaunay_complex.find(stree_from_alpha_complex.simplex_vertex_range(f_simplex)); + BOOST_CHECK(std::isnan(stree_from_delaunay_complex.filtration(sh))); + BOOST_CHECK(sh != stree_from_delaunay_complex.null_simplex()); + } +} -- cgit v1.2.3