14#include <doctest/doctest.h>
20SCENARIO(
"Apply an ergodic move to 2+1 manifolds" *
21 doctest::test_suite(
"apply"))
23 GIVEN(
"A 2+1 dimensional spherical manifold.")
25 auto constexpr desired_simplices = 9600;
26 auto constexpr desired_timeslices = 7;
28 REQUIRE(manifold.is_correct());
30 auto manifold_before = manifold;
31 WHEN(
"A null move is applied to the manifold.")
33 spdlog::debug(
"Applying null move to manifold.\n");
34 if (
auto result =
apply_move(manifold, ergodic_moves::null_move); result)
36 manifold = result.value();
42 spdlog::debug(
"{}", result.error());
43 REQUIRE(result.has_value());
45 THEN(
"The resulting manifold is valid and unchanged.")
47 CHECK(manifold.is_valid());
48 CHECK_EQ(manifold_before.simplices(), manifold.simplices());
49 CHECK_EQ(manifold_before.faces(), manifold.faces());
50 CHECK_EQ(manifold_before.edges(), manifold.edges());
51 CHECK_EQ(manifold_before.vertices(), manifold.vertices());
53 fmt::print(
"Old manifold.\n");
54 manifold_before.print_details();
55 fmt::print(
"New manifold after null move:\n");
56 manifold.print_details();
59 WHEN(
"A (2,3) move is applied to the manifold.")
61 spdlog::debug(
"Applying (2,3) move to manifold.\n");
62 if (
auto result =
apply_move(manifold, ergodic_moves::do_23_move); result)
64 manifold = result.value();
70 spdlog::debug(
"{}", result.error());
71 REQUIRE(result.has_value());
73 THEN(
"The resulting manifold has the applied move.")
75 CHECK(ergodic_moves::check_move(manifold_before, manifold,
76 move_tracker::move_type::TWO_THREE));
78 fmt::print(
"Old manifold.\n");
79 manifold_before.print_details();
80 fmt::print(
"New manifold after (2,3) move:\n");
81 manifold.print_details();
84 WHEN(
"A (3,2) move is applied to the manifold.")
86 spdlog::debug(
"Applying (3,2) move to manifold.\n");
87 if (
auto result =
apply_move(manifold, ergodic_moves::do_32_move); result)
89 manifold = result.value();
95 spdlog::debug(
"{}", result.error());
97 REQUIRE(result.has_value());
99 THEN(
"The resulting manifold has the applied move.")
101 CHECK(ergodic_moves::check_move(manifold_before, manifold,
102 move_tracker::move_type::THREE_TWO));
104 fmt::print(
"Old manifold.\n");
105 manifold_before.print_details();
106 fmt::print(
"New manifold after (3,2) move:\n");
107 manifold.print_details();
110 WHEN(
"A (2,6) move is applied to the manifold.")
112 spdlog::debug(
"Applying (2,6) move to manifold.\n");
113 if (
auto result =
apply_move(manifold, ergodic_moves::do_26_move); result)
115 manifold = result.value();
121 spdlog::debug(
"{}", result.error());
123 REQUIRE(result.has_value());
125 THEN(
"The resulting manifold has the applied move.")
127 CHECK(ergodic_moves::check_move(manifold_before, manifold,
128 move_tracker::move_type::TWO_SIX));
130 fmt::print(
"Old manifold.\n");
131 manifold_before.print_details();
132 fmt::print(
"New manifold after (2,6) move:\n");
133 manifold.print_details();
136 WHEN(
"A (6,2) move is applied to the manifold.")
138 spdlog::debug(
"Applying (6,2) move to manifold.\n");
139 auto result =
apply_move(manifold, ergodic_moves::do_62_move);
142 manifold = result.value();
145 THEN(
"The resulting manifold has the applied move.")
147 CHECK(ergodic_moves::check_move(manifold_before, manifold,
148 move_tracker::move_type::SIX_TWO));
150 fmt::print(
"Old manifold.\n");
151 manifold_before.print_details();
152 fmt::print(
"New manifold after (6,2) move:\n");
153 manifold.print_details();
158 spdlog::warn(
"Cannot apply (6,2) move: {}", result.error());
159 doctest::skip(
"No valid (6,2) move exists in this manifold configuration.");
162 WHEN(
"A (4,4) move is applied to the manifold.")
164 spdlog::debug(
"Applying (4,4) move to manifold.\n");
165 if (
auto result =
apply_move(manifold, ergodic_moves::do_44_move); result)
167 manifold = result.value();
173 spdlog::debug(
"{}", result.error());
175 REQUIRE(result.has_value());
177 THEN(
"The resulting manifold has the applied move.")
179 CHECK(ergodic_moves::check_move(manifold_before, manifold,
180 move_tracker::move_type::FOUR_FOUR));
182 fmt::print(
"Old manifold.\n");
183 manifold_before.print_details();
184 fmt::print(
"New manifold after (4,4) move:\n");
185 manifold.print_details();
Apply Pachner moves to foliated Delaunay triangulations.
auto constexpr apply_move(ManifoldType &&t_manifold, FunctionType t_move) noexcept -> decltype(auto)
An applicative function similar to std::apply on a manifold.
Pachner moves on 2+1 dimensional foliated Delaunay triangulations.
SCENARIO("Perform bistellar flip on Delaunay triangulation" *doctest::test_suite("bistellar"))