Repository navigation
Expand file tree
/
Copy pathRaySolver.h
More file actions
176 lines (128 loc) · 4.94 KB
/
Copy pathRaySolver.h
File metadata and controls
176 lines (128 loc) · 4.94 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#ifndef RAYSOLVER_H
#define RAYSOLVER_H
#include <vector>
#include <iostream>
#include "RayTrace.h"
#include "RayTrace_IceModels.h"
#include "Vector.h"
#include <fstream>
#include <iomanip>
#include "Settings.h"
#ifndef __CINT__
#include <boost/lexical_cast.hpp>
#include <boost/program_options.hpp>
#endif
class Position;
class IceModel;
//--------------------------------------------------
// struct underline{
// static char esc;
// const std::string& str;
// underline(const std::string& s):str(s){}
// friend std::ostream& operator<<(std::ostream& os, const underline& u);
// };
//
// char underline::esc=0x1B;
//
// std::ostream& operator<<(std::ostream& os, const underline& u){
// return(os << underline::esc << "[4m" << u.str << underline::esc << "[0m");
// }
//--------------------------------------------------
template<typename positionType>
class pathPrinter{
public:
pathPrinter(){}
void operator()(const positionType& p, RayTrace::RKStepType stepType){
std::cout << p.x << ' ' << p.z << '\n';
}
};
template<typename positionType>
class pathStore_test{
public:
ofstream pathfile;
// constructor
pathStore_test(std::string filename){
pathfile.open( filename.c_str() );
}
void operator()(const positionType& p, RayTrace::RKStepType stepType){
pathfile << p.x << ' ' << p.z << '\n';
}
};
template<typename positionType>
class pathStore_vector{
public:
std::vector < std::vector <double> > vectorout;
// constructor
pathStore_vector(){
vectorout.resize(2); // x, z
}
void CopyVector( std::vector < std::vector < std::vector<double> > > &vectorname, int solnum ) {
//cout<<"testCopyVector"<<endl;
//cout<<"size : "<<(int)vectorname.size()<<endl;
vectorname[solnum].resize(2); // x, z
for (int step=0; step<(int)vectorout[0].size(); step++) {
vectorname[solnum][0].push_back( vectorout[0][step] );
vectorname[solnum][1].push_back( vectorout[1][step] );
//cout<<"1 x : "<<vectorout[0][step]<<", y : "<<vectorout[1][step]<<endl;
}
}
// delete
void DelVector(){
vectorout.clear();
}
/*
// copy
void CopyVector()(std::vector < std::vector<double> > &vectorname){
for (int step=0; step<(int)vectorout.size(); step++) {
vectorname[0].push_back( vectorout[0][step] );
vectorname[1].push_back( vectorout[1][step] );
}
}
// delete
void DelVector()(){
vectorout.clear();
}
*/
void operator()(const positionType& p, RayTrace::RKStepType stepType){
//pathfile << p.x << ' ' << p.z << '\n';
vectorout[0].push_back( p.x );
vectorout[1].push_back( p.z );
//cout<<"0 x : "<<p.x<<", y : "<<p.z<<endl;
//cout<<"0 x : "<<vectorout[0][(int)vectorout[0].size()-1]<<", y : "<<vectorout[1][(int)vectorout[1].size()-1]<<endl;
}
};
/*
template<typename positionType>
class pathStore_vector_2{
public:
std::vector < std::vector <double> > vectorout;
// constructor
pathStore_vector_2(std::vector < std::vector<double> > &vectorname){
vectorout.resize(2); // x, z
vectorout = &vectorname;
}
void operator()(const positionType& p, RayTrace::RKStepType stepType){
//pathfile << p.x << ' ' << p.z << '\n';
vectorout[0].push_back( p.x );
vectorout[1].push_back( p.z );
}
};
*/
class RaySolver {
private:
void Earth_to_Flat_same_depth(Position &source, Position &target, IceModel* antarctica);
void Earth_to_Flat_same_angle(Position &source, Position &target, IceModel* antarctica);
public:
RaySolver();
// RaySolver(int argc, char* argv[]);
void test1();
void Solve_Ray_org(Position &source, Position &target, std::vector < std::vector <double> > &outputs, Settings *settings1);
//void Solve_Ray_org (double source_x, double source_y, double source_z, double target_x, double target_y, double target_z, double &travel_time, double &travel_dist, int &no_sol, Settings *settings1);
void Solve_Ray_org (double source_x, double source_y, double source_z, double target_x, double target_y, double target_z, bool print_path=false );
//void Solve_Ray(Position &source, Position &target, IceModel *antarctica, std::vector < std::vector <double> > &outputs, Settings *settings1);
void Solve_Ray(Position &source, Position &target, IceModel *antarctica, std::vector < std::vector <double> > &outputs, Settings *settings1, std::vector < std::vector < std::vector <double> > > &RayStep );
void ApplyNofzSystematics(double& ns, double& nd, double& nc, Settings* settings1);
int source_over_surface;
int solution_toggle; // no solution : 0 solution exist : 1
};
#endif //RAYSOLVER_H