18void execute_simulation(std::vector<std::string> &args)
21 if (args.size() < 11) {
28 if (args.size() >= 11 && args.size() < 16) {
30 std::stod(args[2]), std::stod(args[3]), std::stod(args[4]),
31 std::stod(args[5]), std::stod(args[6]), std::stod(args[7]),
32 std::stod(args[8]), std::stod(args[9]), std::stod(args[10]));
35 else if (args.size() >= 16) {
37 std::stod(args[2]), std::stod(args[3]), std::stod(args[4]),
38 std::stod(args[5]), std::stod(args[6]), std::stod(args[7]),
39 std::stod(args[8]), std::stod(args[9]), std::stod(args[10]),
40 std::stod(args[11]), std::stod(args[12]), std::stod(args[13]),
41 std::stod(args[14]), std::stoi(args[15]));
45 if (args[0].compare(
"deviation") == 0) {
46 if (args.size() == 17) {
49 else if (args.size() == 12) {
57 else if (args[0].compare(
"simulate") == 0) {
58 if (args.size() == 17) {
59 sim->
simulate(args[1], args[16].compare(
"false"));
61 else if (args.size() == 12) {
62 sim->
simulate(args[1], args[11].compare(
"false"));
64 else if (args.size() > 17) {
65 std::vector<double> arr;
66 for (
size_t i = 16; i < args.size(); i++) {
67 arr.push_back(std::stod(args[i]));
78int main(
int argc,
char **argv)
85 std::string filename = argv[1];
88 infile.open(filename);
90 for (std::string line; std::getline(infile, line);) {
91 std::vector<std::string> arr = utils::split(line,
';');
92 execute_simulation(arr);
The definition of the WaveSimulation class.
Simulate the evolution of a wave packet in 2 + 1 domensions.
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.
void probability_deviation(std::string outfile, bool write_each_step=false)
Write the deviation of the sum of the probability of U from 1.
Function prototypes and macros that are useful.