/** @file main.cpp
 *
 *  @author Cory Alexander Balaton (coryab)
 *  @author Janita Ovidie Sandtrøen Willumsen (janitaws)
 *
 *  @version 0.1
 *
 *  @brief The main program
 *
 *  @bug No known bugs
 * */
#include "monte_carlo.hpp"
#include "utils.hpp"

#include <iostream>
#include <omp.h>

/** @brief The main function.*/
int main()
{
    // uint test_cycles = test_2x2_lattice(1e-7, 10000);
    // monte_carlo(1.0, 2, 10000, "output/2_lattice_test.txt");

    // Test burn-in time
    monte_carlo_progression(1.0, 20, 10000, "output/burn_in_time_1_0.txt");
    monte_carlo_progression(2.4, 20, 10000, "output/burn_in_time_2_4.txt");

    // Test the openmp speedup
    double t0, t1, t2;
    t0 = omp_get_wtime();
    phase_transition(20, 2.1, 2.4, 1000, monte_carlo_serial,
                     "output/phase_transition/size_20.txt");
    t1 = omp_get_wtime();
    phase_transition(20, 2.1, 2.4, 1000, monte_carlo_parallel,
                     "output/phase_transition/size_20.txt");
    t2 = omp_get_wtime();

    std::cout << "Time serial     : " << t1 - t0 << " seconds" << '\n';
    std::cout << "Time parallel   : " << t2 - t1 << " seconds" << '\n';
    std::cout << "Speedup parallel: " << (t1 - t0) / (t2 - t1) << '\n';

    return 0;
}
