Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
#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;
}
WaveSimulation.hpp
The definition of the WaveSimulation class.
WaveSimulation
Simulate the evolution of a wave packet in 2 + 1 domensions.
Definition: WaveSimulation.hpp:22
WaveSimulation::simulate
void simulate(std::string outfile, bool write_each_step=false)
Evolve the wave packet until the time T has been reached and write U to file.
utils.hpp
Function prototypes and macros that are useful.
DEBUG
#define DEBUG(msg)
Writes a debug message.
Definition: utils.hpp:39