CDT++
Causal Dynamical Triangulations in C++
Loading...
Searching...
No Matches
cdt-opt.cpp
Go to the documentation of this file.
1/*******************************************************************************
2 Causal Dynamical Triangulations in C++ using CGAL
3
4 Copyright © 2016 Adam Getchell
5 ******************************************************************************/
6
17
18#include <Metropolis.hpp>
19#include <Move_always.hpp>
20
21using namespace std;
22
23auto main() -> int
24try
25{
26 fmt::print("cdt-opt started at {}\n", utilities::current_date_time());
27 Int_precision constexpr simplices = 256;
28 Int_precision constexpr timeslices = 4;
30 auto constexpr alpha = static_cast<long double>(0.6);
31 auto constexpr k = static_cast<long double>(1.1); // NOLINT
33 auto constexpr lambda = static_cast<long double>(0.1);
34 Int_precision constexpr passes = 10;
35 Int_precision constexpr checkpoint = 10;
36
37 // Create logs
38 utilities::create_logger();
39
40 // Initialize the Metropolis algorithm
41 Metropolis_3 run(alpha, k, lambda, passes, checkpoint);
42
43 // Make a triangulation
44 manifolds::Manifold_3 const universe(simplices, timeslices);
45
46 // Look at triangulation
47 universe.print();
48 universe.print_details();
50
51 // Run algorithm on triangulation
52 auto const result = run(universe);
53
54 if (auto max_timevalue = result.max_time(); max_timevalue < timeslices)
55 {
56 spdlog::info("You wanted {} timeslices but only got {}.\n", timeslices,
57 max_timevalue);
58 }
59
60 if (!result.is_valid()) { throw runtime_error("Result is invalid!\n"); }
61
62 // Print results
63 fmt::print("=== Run Results ===\n");
64 result.print();
65 result.print_details();
66 result.print_volume_per_timeslice();
67
68 return EXIT_SUCCESS;
69}
70catch (runtime_error const& RuntimeError)
71{
72 spdlog::critical("{}\n", RuntimeError.what());
73 return EXIT_FAILURE;
74}
75catch (...)
76{
77 spdlog::critical("Something went wrong ... Exiting.\n");
78 return EXIT_FAILURE;
79}
Perform Metropolis-Hastings algorithm on Delaunay Triangulations.
Randomly selects moves to always perform on triangulations.
std::int_fast32_t Int_precision
Definition: Settings.hpp:31
auto main() -> int try
Definition: cdt-opt.cpp:23
Select a move algorithm.
void print() const
Print manifold.
Definition: Manifold.hpp:372
void print_details() const
Print details of the manifold.
Definition: Manifold.hpp:387
void print_volume_per_timeslice() const
Print the codimension 1 volume of simplices (faces) per timeslice.
Definition: Manifold.hpp:359