diff options
author | Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> | 2023-01-13 15:19:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-13 15:19:40 +0100 |
commit | 83d1fc15e402551d2d4a7be8d4ecc124e9f886d5 (patch) | |
tree | 736241d96c9bd6813816d3ff2dd37966c85a24e4 /src/Alpha_complex/test/Delaunay_complex_unit_test.h | |
parent | 533efd51253b0770f9a7de04a42f0820f1a1af66 (diff) | |
parent | d35581357525d02e3126e9fe901904cc764e1f5c (diff) |
Merge pull request #789 from VincentRouvreau/split_delaunay_triangulation_unitary_testsupstream-2/latest
Split Delaunay complex in 4 executables to relieve windows CI
Diffstat (limited to 'src/Alpha_complex/test/Delaunay_complex_unit_test.h')
-rw-r--r-- | src/Alpha_complex/test/Delaunay_complex_unit_test.h | 49 |
1 files changed, 49 insertions, 0 deletions
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 <vector> +#include <limits> // NaN +#include <cmath> + +#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 <gudhi/Unitary_tests_utils.h> +#include <gudhi/random_point_generators.h> + +using Simplex_tree = Gudhi::Simplex_tree<>; +using Simplex_handle = Simplex_tree::Simplex_handle; + +template<class CGAL_kernel> +void compare_delaunay_complex_simplices() { + std::cout << "*****************************************************************************************************"; + using Point = typename CGAL_kernel::Point_d; + std::vector<Point> points; + // 50 points on a 4-sphere + points = Gudhi::generate_points_on_sphere_d<CGAL_kernel>(10, 5, 1.); + + Gudhi::alpha_complex::Alpha_complex<CGAL_kernel> 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()); + } +} |