-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·73 lines (55 loc) · 1.49 KB
/
Copy pathmain.cpp
File metadata and controls
executable file
·73 lines (55 loc) · 1.49 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <iostream>
using namespace std;
#include <fstream>
#include <vector>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include "mpreal.h"
using namespace mpfr;
#include "Brutus.h"
int main(int argc, char* argv[]) {
// using mpfr::mpreal;
int n;
mpreal t_end;
mpreal eta = "0.24";
mpreal t = "0";
mpreal epsilon; // = "1e-6"; // Bulirsch-Stoer tolerance
int numBits;
double dt;
int pmax;
cin >> n >> t_end >> dt >> epsilon >> numBits >> pmax;
cout << "# n=" << n << " tend=" << t_end << " dt=" << dt << " eps=" << epsilon << " lw=" << numBits << " pmax=" << pmax <<endl;
//store data in vector
vector<double> data(7*n);
vector<mpreal> datmp(7*n);
double temp;
for (int i = 0; i < data.size(); ++i){
cin >> data[i];
datmp[i] = (mpreal)data[i];
//cout << datmp[i] << " " << i << endl;
}
//Brutus brutus = Brutus(datmp);
Brutus brutus = Brutus(t, datmp, epsilon, numBits, pmax);
vector<string> v = brutus.get_data_string();
vector<mpreal> e3;
mpreal e30 = brutus.get_energies()[0];
cout << t << " " << 0.0 << " ";
for (int i = 0; i < v.size(); ++i){
cout << v[i] << " ";
}
cout << endl;
while(t<t_end) {
t+=dt;
brutus.evolve((mpreal)t);
v = brutus.get_data_string();
e3 = brutus.get_energies();
cout << t << " " << (e3[0]/e30-1.0) << " ";
for (int i = 0; i < v.size(); ++i){
cout << v[i] << " ";
}
cout << endl;
}
//Brutus intB = Brutus();
return 0;
}