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

#include <fstream>

void probability_deviation()
{
    DEBUG("Sim no slits");
    WaveSimulation sim_no_slits(.005, 2.5e-5, .008, .25, .5, .05, .05, 200.,
                                0.);

    DEBUG("Sim with slits");
    WaveSimulation sim_slits(.005, 2.5e-5, .008, .25, .5, .05, .10, 200., 0.,
                             0.02, .5, .05, .05, 2);

    DEBUG("Probability deviation");
    sim_no_slits.probability_deviation(
        "data/probability_deviation_no_slits.txt", true);
    DEBUG("Probability deviation with slits");
    sim_slits.probability_deviation("data/probability_deviation_slits.txt",
                                    true);
}

void color_map()
{
    WaveSimulation sim(.005, 2.5e-5, .002, .25, .5, .05, .20, 200., 0., 0.02,
                       .5, .05, .05, 2);

    std::vector<double> times{0., .001, .002};
    sim.simulate("data/color_map.txt", times);
}

void detector_screen()
{
    WaveSimulation *sim = new WaveSimulation(
        .005, 2.5e-5, .002, .25, .5, .05, .20, 200., 0., 0.02, .5, .05, .05, 1);

    sim->simulate("data/screen/single_slit.txt");

    delete sim;
    sim = new WaveSimulation(.005, 2.5e-5, .002, .25, .5, .05, .20, 200., 0.,
                             0.02, .5, .05, .05, 2);

    sim->simulate("data/screen/double_slit.txt");

    delete sim;
    sim = new WaveSimulation(.005, 2.5e-5, .002, .25, .5, .05, .20, 200., 0.,
                             0.02, .5, .05, .05, 3);

    sim->simulate("data/screen/triple_slit.txt");
}

void animation()
{
    std::ofstream ofile;
    ofile.open("test.txt");
    WaveSimulation sim(.005, 2.5e-5, .008, .25, .5, .05, .10, 200., 0., 0.02,
                       .5, .05, .05, 2);
    sim.simulate("data/animation.txt", true);
}

int main()
{
    probability_deviation();
    color_map();
    detector_screen();
    animation();

    return 0;
}
