-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindTca.cpp
More file actions
57 lines (50 loc) · 1.32 KB
/
findTca.cpp
File metadata and controls
57 lines (50 loc) · 1.32 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
#define _USE_MATH_DEFINES
#define WITH_ALGEBRAICMATRIX
#include <dace/dace.h>
#include <cmath>
#include <ctime>
#include <fstream>
#include <iomanip>
#include "camRoutines.h"
#include <chrono>
using namespace std;
using namespace DACE;
using namespace std::chrono;
using namespace cam;
int main(void)
{
int i;
ifstream nodes;
AlgebraicVector<double> xdump(6), xdums(6);
ifstream Input;
long time1 = time_point_cast<milliseconds>(system_clock::now()).time_since_epoch().count();
Input.open("./write_read/initial_state.dat");
for (i = 0; i < 6; i ++) {
Input >> xdump[i];
}
for (i = 0; i < 6; i ++) {
Input >> xdums[i];
}
Input.close();
// DA initialization
DA::init(1, 7);
DA::setEps(1e-30);
AlgebraicVector<DA> xp0(6), xpf(6), xs0(6), xsf(6), xrel(6);
DA dt, tca;
// write output
ofstream tcaOut;
tcaOut.open("./write_read/tcaOut.dat");
tcaOut << setprecision(30);
// final time espansion
dt = 0.0 + DA(7);
for (i = 0; i < 6; i ++) {
xs0[i] = xdums[i] + DA(i+1);
xp0[i] = xdump[i] + DA(i+1)*0;
}
xpf = KeplerProp(xp0, dt, 1.0);
xsf = KeplerProp(xs0, dt, 1.0);
xrel = xpf - xsf;
tca = findTCA(xrel, 7);
tcaOut << cons(tca) << endl;
tcaOut.close();
}