-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
53 lines (44 loc) · 1.78 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <fstream>
#include <vector>
#include "Mesh.h"
#include "Device.h"
#include "MaterialModel.h"
#include "Problem.h"
#include <armadillo>
#include <json.hpp>
int main(){
//Reading data:
std::ifstream file("settings.json");
nlohmann::json settings;
file >> settings;
//Creating problem:
Problem real_problem {
settings["mesh"]["nel"],
settings["mesh"]["ned"],
settings["domain"]["length"],
settings["domain"]["depth"],
settings["time"]["pulse_int"],
settings["time"]["pulse_freq"],
settings["time"]["period"],
settings["time"]["dt"],
settings["levelset"]["init"]
};
real_problem.add_device("receiver", 1.0, 1.0, 0);
real_problem.add_device("source", 1.5, 1.5, 0);
real_problem.add_device("source", 1.5, 1.5, 1);
real_problem.add_device("source", 1.5, 1.5, 2);
// real_problem.add_device("source", 1.0,1.5,0);
// real_problem.add_device("source", 1.5,1.0,0);
real_problem.set_control(settings["levelset"]["n_lvls"],
settings["levelset"]["levels"],
settings["levelset"]["vels"]);
real_problem.build();
real_problem.solve("forward_only");
real_problem.write_output(settings["output"]["save_solution"],
settings["output"]["shot_id"],
settings["output"]["sample_size"]);
std::cout << " " << std::endl;
std::cout << "This program ended succesfully. " << std::endl;
return 0;
}