-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathS3Action_test.cpp
103 lines (94 loc) · 3.72 KB
/
S3Action_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*******************************************************************************
Causal Dynamical Triangulations in C++ using CGAL
Copyright © 2017 Adam Getchell
******************************************************************************/
/// @file S3Action_test.cpp
/// @brief Tests for the S3 action functions
/// @author Adam Getchell
/// @details Ensures that the S3 bulk action calculations are correct, and give
/// similar results for similar values.
#include "S3Action.hpp"
#include <doctest/doctest.h>
#include "Manifold.hpp"
using namespace std;
using namespace manifolds;
SCENARIO("Calculate the bulk action on S3 triangulations" *
doctest::test_suite("s3action"))
{
spdlog::debug("Calculate the bulk action on S3 triangulations.\n");
GIVEN("A 3D 2-sphere foliated triangulation.")
{
auto constexpr simplices = 6400;
auto constexpr timeslices = 7;
auto constexpr K = 1.1L; // NOLINT
auto constexpr Lambda = 0.1L;
Manifold_3 const universe(simplices, timeslices);
// Verify triangulation
CHECK_EQ(universe.N3(), universe.simplices());
CHECK_EQ(universe.N1(), universe.edges());
CHECK_EQ(universe.N0(), universe.vertices());
CHECK_EQ(universe.dimensionality(), 3);
CHECK(universe.is_correct());
universe.print_volume_per_timeslice();
CHECK_EQ(universe.max_time(), timeslices);
CHECK_EQ(universe.min_time(), 1);
WHEN("The alpha=-1 Bulk Action is calculated.")
{
auto Bulk_action = S3_bulk_action_alpha_minus_one(
universe.N1_TL(), universe.N3_31_13(), universe.N3_22(), K, Lambda);
THEN("The action falls within accepted values.")
{
spdlog::debug("S3_bulk_action_alpha_minus_one() = {}\n",
Bulk_action.to_double());
REQUIRE_LE(3500, Bulk_action);
REQUIRE_LE(Bulk_action, 4500);
}
}
WHEN("The alpha=1 Bulk Action is calculated.")
{
auto Bulk_action = S3_bulk_action_alpha_one(
universe.N1_TL(), universe.N3_31_13(), universe.N3_22(), K, Lambda);
THEN("The action falls within accepted values.")
{
spdlog::debug("S3_bulk_action_alpha_one() = {}\n",
Bulk_action.to_double());
REQUIRE_LE(2000, Bulk_action);
REQUIRE_LE(Bulk_action, 3000);
}
}
WHEN("The generalized Bulk Action is calculated.")
{
auto constexpr Alpha = 0.6L;
spdlog::debug("(Long double) Alpha = {}\n", Alpha);
auto Bulk_action = S3_bulk_action(universe.N1_TL(), universe.N3_31_13(),
universe.N3_22(), Alpha, K, Lambda);
THEN("The action falls within accepted values.")
{
spdlog::debug("S3_bulk_action() = {}\n", Bulk_action.to_double());
REQUIRE_LE(2700, Bulk_action);
REQUIRE_LE(Bulk_action, 3700);
}
}
WHEN(
"S3_bulk_action(alpha=1) and S3_bulk_action_alpha_one() are "
"calculated.")
{
auto constexpr Alpha = 1.0L;
auto Bulk_action = S3_bulk_action(universe.N1_TL(), universe.N3_31_13(),
universe.N3_22(), Alpha, K, Lambda);
auto Bulk_action_one = S3_bulk_action_alpha_one(
universe.N1_TL(), universe.N3_31_13(), universe.N3_22(), K, Lambda);
THEN(
"S3_bulk_action(alpha=1) == S3_bulk_action_alpha_one() within "
"tolerances.")
{
spdlog::debug("S3_bulk_action() = {}\n", Bulk_action.to_double());
spdlog::debug("S3_bulk_action_alpha_one() = {}\n",
Bulk_action_one.to_double());
REQUIRE(utilities::Gmpzf_to_double(Bulk_action_one) ==
doctest::Approx(utilities::Gmpzf_to_double(Bulk_action))
.epsilon(TOLERANCE));
}
}
}
}