FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Aether/include/logfile.h at develop · AetherModel/Aether · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
AetherModel
/
Aether
Public
Notifications
You must be signed in to change notification settings
Fork
31
Star
25
Code
Issues
21
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Aether
/
include
/
logfile.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
139 lines (115 loc) · 3.89 KB
Breadcrumbs
Aether
/
include
/
logfile.h
Copy path
File metadata and controls
139 lines (115 loc) · 3.89 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//
Copyright 2020, the Aether Development Team (see doc/dev_team.md for members)
//
Full license can be found in License.md
#
ifndef
INCLUDE_LOGFILE_H_
#
define
INCLUDE_LOGFILE_H_
/*
*************************************************************
*
* logfile.h:
*
* Write the logfile
*
*************************************************************
*/
#
include
"
aether.h
"
#
include
<
fstream
>
#
include
<
iostream
>
/*
*
* The class Satellite is used to track the satellites
* Given any time, the user can obtain the geographic location of the satellite
*
* ASSUMPTION : The satellite csv layout is the same as the following
* year mon day hr min sec lon lat alt x y z vx vy vz
* (int) (int) (int) (int) (int) (int) (degree) (degree) (km) (km) (km) (km) (km/s) (km/s) (km/s)
*/
class
Satellite
{
public:
/*
*
* \brief Initialize the satellite class
* The name of the satellite is not allowed to have any characters which can
* terminate the read of a string including white space' ', endline'\n', and '\t'
* Different satellites must have different names (not only input file names)
* \param csv_in The path to the satellite csv file
* \param log_name_in The path to write the satellite log file
* \param sat_header The first line of the log file
* \param dt_in The time gate
*/
Satellite
(
const
std::string &csv_in,
const
std::string &log_name_in,
const
std::string &sat_header,
const
precision_t
dt_in);
/*
*
* \brief Get the position of the satellite at given time
* \param lons_out Vector to stroe the longitude of the location
* \param lats_out Vector to store the latitude of the location
* \param alts_out Vector to store the altitude of the location
* \param time_in Time to determine location
*/
void
get_position
(std::vector<
precision_t
> &lons_out,
std::vector<
precision_t
> &lats_out,
std::vector<
precision_t
> &alts_out,
const
double
time_in)
const
;
//
Get the name of the satellite
std::string
get_name
()
const
;
//
Get the time gate of the satellite
precision_t
get_dt
()
const
;
//
Write the content to the satellite log
void
write_log
(
const
std::vector<
int
> &iCurrent,
const
std::vector<
precision_t
> &variables);
//
DEBUG
void
print
();
private:
//
The name of the satellite
std::string name;
//
The time gate
precision_t
dt;
//
The file name to write log
std::string log_name;
//
The time should always be ascending
//
The type for time is double rather than precision_t
std::vector<
double
> timereals;
//
The position of the satellite at those times
std::vector<
precision_t
> lons;
std::vector<
precision_t
> lats;
std::vector<
precision_t
> alts;
//
The rest columns are not used (i.e. from x to vz)
};
/*
*
* The class to maintain the logfile
*/
class
Logfile
{
public:
/*
*
* \brief Initialize the Logfile.
* The logfile will output all indicies and specified neutrals and ions
* every dt time.
*/
Logfile
(Indices &indices,
int64_t
iLog);
/*
*
* \brief Close the file stream if not append
*/
~Logfile
();
/*
*
* \brief Check the time gate, and write the values into log file
* if needed
*/
bool
write_logfile
(Indices &indices,
Neutrals &neutrals,
Ions &ions,
Grid &
gGrid
,
Times &time);
private:
//
The name of logfile
std::string logfileName;
//
The file stream to write
std::ofstream logfilestream;
//
The specified variables
std::vector<std::string> species;
//
The satellites as a vector
std::vector<Satellite> satellites;
//
The time gate
precision_t
dt;
//
Whether append or rewrite
bool
doAppend;
//
A randomly chosen point for test
std::vector<
precision_t
> lla {
2
,
2
,
2
};
};
#
endif
//
INCLUDE_LOGFILE_H_
Back
|
FazBrowse Home
|
New Git URL