Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alexander Lapshin
common
Commits
038eaefb
Commit
038eaefb
authored
Mar 27, 2021
by
Alexander Lapshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ rnb interpolation
parent
c349d077
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
66 deletions
+55
-66
interpolate.cpp
utils/interpolate.cpp
+28
-47
interpolate.h
utils/interpolate.h
+6
-14
ires.cpp
utils/ires.cpp
+12
-0
ires.h
utils/ires.h
+8
-2
orbBlock.cpp
utils/orbBlock.cpp
+1
-1
orb_block_data.h
utils/orb_block_data.h
+0
-2
No files found.
utils/interpolate.cpp
View file @
038eaefb
#include "interpolate.h"
#include "interpolate.h"
#include "Propagator.h"
#include "Propagator.h"
#include "GreenwichFrame.h"
#include <algorithm>
#include <algorithm>
static
double
get_step
(
const
double
period
,
const
double
ecc
)
static
double
get_step
(
const
double
period
,
const
double
ecc
)
...
@@ -38,17 +37,13 @@ XInterpolator::XInterpolator(const SInitOrbit& orbit, const TimeJD& beg, const T
...
@@ -38,17 +37,13 @@ XInterpolator::XInterpolator(const SInitOrbit& orbit, const TimeJD& beg, const T
create
(
orbit
,
beg
,
end
,
calc_rnb
);
create
(
orbit
,
beg
,
end
,
calc_rnb
);
}
}
XInterpolator
::
XInterpolator
(
XInterpolator
::
XInterpolator
(
std
::
vector
<
IRes
>
xyz
)
const
std
::
vector
<
IRes
>&
vec
,
const
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
)
{
{
std
::
vector
<
IRes
>
svec
=
vec
;
std
::
sort
(
xyz
.
begin
(),
xyz
.
end
(),
[](
const
IRes
&
a
,
const
IRes
&
b
)
{
std
::
sort
(
svec
.
begin
(),
svec
.
end
(),
[](
const
IRes
&
a
,
const
IRes
&
b
)
{
return
a
.
get_date
()
<
b
.
get_date
();
return
(
a
.
get_date
()
<
b
.
get_date
());
});
});
create
(
svec
,
rnb
);
create
(
xyz
);
}
}
void
XInterpolator
::
propagate_dir
(
void
XInterpolator
::
propagate_dir
(
...
@@ -57,8 +52,7 @@ void XInterpolator::propagate_dir(
...
@@ -57,8 +52,7 @@ void XInterpolator::propagate_dir(
const
TimeJD
&
end
,
const
TimeJD
&
end
,
const
int
dir
,
const
int
dir
,
const
bool
calc_rnb
,
const
bool
calc_rnb
,
std
::
vector
<
IRes
>&
xyz
,
std
::
vector
<
IRes
>&
xyz
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
)
)
{
{
const
bool
variates
=
orbit
.
GetCovMtx
().
HasMtx
()
&&
orbit
.
GetMotionModel
().
GetType
()
==
ST_PROP
&&
calc_rnb
;
const
bool
variates
=
orbit
.
GetCovMtx
().
HasMtx
()
&&
orbit
.
GetMotionModel
().
GetType
()
==
ST_PROP
&&
calc_rnb
;
...
@@ -84,10 +78,13 @@ void XInterpolator::propagate_dir(
...
@@ -84,10 +78,13 @@ void XInterpolator::propagate_dir(
else
{
else
{
SInitOrbit
norb
;
SInitOrbit
norb
;
prop
.
Propagate
(
date
,
norb
);
prop
.
Propagate
(
date
,
norb
);
xyz
.
emplace_back
(
norb
.
GetPhasePointJ2000
().
CoordsVel
,
date
,
age
,
orbit
.
GetId
());
std
::
map
<
std
::
string
,
double
>
covrnb
=
norb
.
GetCovMtx
().
GetCovRnbMap
(
norb
.
GetPhasePointJ2000
().
CoordsVel
);
std
::
map
<
std
::
string
,
double
>
covrnb
=
norb
.
GetCovMtx
().
GetCovRnbMap
(
norb
.
GetPhasePointJ2000
().
CoordsVel
);
rnb
.
emplace_back
(
covrnb
[
"RR"
],
covrnb
[
"NN"
],
covrnb
[
"BB"
]);
xyz
.
emplace_back
(
norb
.
GetPhasePointJ2000
().
CoordsVel
,
Vect3
(
covrnb
[
"RR"
],
covrnb
[
"NN"
],
covrnb
[
"BB"
]),
date
,
age
,
orbit
.
GetId
());
}
}
date
=
ShiftDate
(
date
,
dir
*
step
);
date
=
ShiftDate
(
date
,
dir
*
step
);
...
@@ -100,16 +97,15 @@ void XInterpolator::propagate(
...
@@ -100,16 +97,15 @@ void XInterpolator::propagate(
const
TimeJD
&
end
,
const
TimeJD
&
end
,
const
int
dir
,
const
int
dir
,
const
bool
calc_rnb
,
const
bool
calc_rnb
,
std
::
vector
<
IRes
>&
xyz
,
std
::
vector
<
IRes
>&
xyz
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
)
)
{
{
if
(
dir
!=
0
)
{
if
(
dir
!=
0
)
{
propagate_dir
(
orbit
,
beg
,
end
,
dir
,
calc_rnb
,
xyz
,
rnb
);
propagate_dir
(
orbit
,
beg
,
end
,
dir
,
calc_rnb
,
xyz
);
}
}
else
{
else
{
propagate_dir
(
orbit
,
ShiftDate
(
orbit
.
GetDate
(),
+
get_step
(
orbit
)
/
2.0
),
end
,
+
1
,
calc_rnb
,
xyz
,
rnb
);
propagate_dir
(
orbit
,
ShiftDate
(
orbit
.
GetDate
(),
+
get_step
(
orbit
)
/
2.0
),
end
,
+
1
,
calc_rnb
,
xyz
);
propagate_dir
(
orbit
,
ShiftDate
(
orbit
.
GetDate
(),
-
get_step
(
orbit
)
/
2.0
),
beg
,
-
1
,
calc_rnb
,
xyz
,
rnb
);
propagate_dir
(
orbit
,
ShiftDate
(
orbit
.
GetDate
(),
-
get_step
(
orbit
)
/
2.0
),
beg
,
-
1
,
calc_rnb
,
xyz
);
}
}
std
::
sort
(
xyz
.
begin
(),
xyz
.
end
(),
[](
const
IRes
&
a
,
const
IRes
&
b
)
{
std
::
sort
(
xyz
.
begin
(),
xyz
.
end
(),
[](
const
IRes
&
a
,
const
IRes
&
b
)
{
...
@@ -122,8 +118,8 @@ void XInterpolator::calc_positions(
...
@@ -122,8 +118,8 @@ void XInterpolator::calc_positions(
const
TimeJD
&
beg
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
const
TimeJD
&
end
,
const
bool
calc_rnb
,
const
bool
calc_rnb
,
std
::
vector
<
IRes
>&
xyz
,
std
::
vector
<
IRes
>&
xyz
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
)
)
{
{
const
int
n
=
100
;
const
int
n
=
100
;
const
int
step
=
get_step
(
orbit
);
const
int
step
=
get_step
(
orbit
);
...
@@ -132,13 +128,13 @@ void XInterpolator::calc_positions(
...
@@ -132,13 +128,13 @@ void XInterpolator::calc_positions(
const
TimeJD
end_ext
=
ShiftDate
(
end
,
+
n
*
step
);
const
TimeJD
end_ext
=
ShiftDate
(
end
,
+
n
*
step
);
if
(
orbit
.
GetDate
()
<=
beg_ext
)
{
if
(
orbit
.
GetDate
()
<=
beg_ext
)
{
propagate
(
orbit
,
beg_ext
,
end_ext
,
1
,
calc_rnb
,
xyz
,
rnb
);
propagate
(
orbit
,
beg_ext
,
end_ext
,
1
,
calc_rnb
,
xyz
);
}
}
else
if
(
orbit
.
GetDate
()
>=
end_ext
)
{
else
if
(
orbit
.
GetDate
()
>=
end_ext
)
{
propagate
(
orbit
,
end_ext
,
beg_ext
,
-
1
,
calc_rnb
,
xyz
,
rnb
);
propagate
(
orbit
,
end_ext
,
beg_ext
,
-
1
,
calc_rnb
,
xyz
);
}
}
else
{
else
{
propagate
(
orbit
,
beg_ext
,
end_ext
,
0
,
calc_rnb
,
xyz
,
rnb
);
propagate
(
orbit
,
beg_ext
,
end_ext
,
0
,
calc_rnb
,
xyz
);
}
}
}
}
...
@@ -193,15 +189,11 @@ void finalize(ei& ephi)
...
@@ -193,15 +189,11 @@ void finalize(ei& ephi)
void
XInterpolator
::
create
(
const
SInitOrbit
&
orbit
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
const
bool
calc_rnb
)
void
XInterpolator
::
create
(
const
SInitOrbit
&
orbit
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
const
bool
calc_rnb
)
{
{
std
::
vector
<
IRes
>
xyz
;
std
::
vector
<
IRes
>
xyz
;
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>
rnb
;
calc_positions
(
orbit
,
beg
,
end
,
calc_rnb
,
xyz
);
calc_positions
(
orbit
,
beg
,
end
,
calc_rnb
,
xyz
,
rnb
);
create
(
xyz
);
create
(
xyz
,
rnb
);
}
}
void
XInterpolator
::
create
(
void
XInterpolator
::
create
(
const
std
::
vector
<
IRes
>&
xyz
)
const
std
::
vector
<
IRes
>&
xyz
,
const
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
)
{
{
m_beg
=
xyz
.
front
().
get_date
();
m_beg
=
xyz
.
front
().
get_date
();
m_end
=
xyz
.
back
().
get_date
();
m_end
=
xyz
.
back
().
get_date
();
...
@@ -215,25 +207,14 @@ void XInterpolator::create(
...
@@ -215,25 +207,14 @@ void XInterpolator::create(
finalize
(
m_ephi
);
finalize
(
m_ephi
);
m_positions
=
xyz
;
m_positions
=
xyz
;
if
(
!
rnb
.
empty
())
{
if
(
!
xyz
.
empty
()
&&
xyz
.
front
().
has_rnb
())
{
init
(
m_rnb_ephi
,
rnb
.
size
());
init
(
m_rnb_ephi
,
xyz
.
size
());
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
rnb
.
size
());
i
++
){
for
(
const
auto
&
p
:
xyz
)
{
const
auto
&
xyz_p
=
xyz
[
i
];
fill
(
Vect6
(
p
.
get_rnb
(),
Vect3
()),
p
.
get_date
().
GetDays
(),
p
.
get_date
().
GetFraction
(),
m_rnb_ephi
);
const
auto
&
rnb_p
=
rnb
[
i
];
const
Vect6
v
(
std
::
get
<
0
>
(
rnb_p
),
std
::
get
<
1
>
(
rnb_p
),
std
::
get
<
2
>
(
rnb_p
),
0
,
0
,
0
);
fill
(
v
,
xyz_p
.
get_date
().
GetDays
(),
xyz_p
.
get_date
().
GetFraction
(),
m_rnb_ephi
);
}
}
finalize
(
m_rnb_ephi
);
finalize
(
m_rnb_ephi
);
m_rnb
=
rnb
;
}
}
}
}
...
...
utils/interpolate.h
View file @
038eaefb
...
@@ -11,9 +11,7 @@ class XInterpolator
...
@@ -11,9 +11,7 @@ class XInterpolator
public
:
public
:
XInterpolator
();
XInterpolator
();
XInterpolator
(
const
SInitOrbit
&
orbit
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
bool
calc_rnb
);
XInterpolator
(
const
SInitOrbit
&
orbit
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
bool
calc_rnb
);
XInterpolator
(
XInterpolator
(
std
::
vector
<
IRes
>
xyz
);
const
std
::
vector
<
IRes
>&
vec
,
const
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
);
Vect6
get_pos
(
const
TimeJD
&
date
,
bool
tks
=
false
)
const
;
Vect6
get_pos
(
const
TimeJD
&
date
,
bool
tks
=
false
)
const
;
TimeJD
get_beg
()
const
{
return
m_beg
;
}
TimeJD
get_beg
()
const
{
return
m_beg
;
}
TimeJD
get_end
()
const
{
return
m_end
;
}
TimeJD
get_end
()
const
{
return
m_end
;
}
...
@@ -22,32 +20,26 @@ public:
...
@@ -22,32 +20,26 @@ public:
const
TimeJD
&
beg
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
const
TimeJD
&
end
,
bool
calc_rnb
,
bool
calc_rnb
,
std
::
vector
<
IRes
>&
xyz
,
std
::
vector
<
IRes
>&
xyz
);
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
);
void
export_data
()
const
;
void
export_data
()
const
;
std
::
vector
<
IRes
>
m_positions
;
std
::
vector
<
IRes
>
m_positions
;
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>
m_rnb
;
private
:
private
:
void
create
(
const
SInitOrbit
&
orbit
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
bool
calc_rnb
);
void
create
(
const
SInitOrbit
&
orbit
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
bool
calc_rnb
);
void
create
(
void
create
(
const
std
::
vector
<
IRes
>&
xyz
);
const
std
::
vector
<
IRes
>&
xyz
,
const
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
);
static
void
propagate
(
static
void
propagate
(
const
SInitOrbit
&
orbit
,
const
SInitOrbit
&
orbit
,
const
TimeJD
&
beg
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
const
TimeJD
&
end
,
int
dir
,
int
dir
,
const
bool
calc_rnb
,
bool
calc_rnb
,
std
::
vector
<
IRes
>&
xyz
,
std
::
vector
<
IRes
>&
xyz
);
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
);
static
void
propagate_dir
(
static
void
propagate_dir
(
const
SInitOrbit
&
orbit
,
const
SInitOrbit
&
orbit
,
const
TimeJD
&
beg
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
const
TimeJD
&
end
,
const
int
dir
,
const
int
dir
,
bool
calc_rnb
,
bool
calc_rnb
,
std
::
vector
<
IRes
>&
xyz
,
std
::
vector
<
IRes
>&
xyz
);
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
rnb
);
TimeJD
m_beg
;
TimeJD
m_beg
;
TimeJD
m_end
;
TimeJD
m_end
;
ei
m_ephi
;
ei
m_ephi
;
...
...
utils/ires.cpp
View file @
038eaefb
...
@@ -14,6 +14,18 @@ IRes::IRes(const Vect6& vec, const TimeJD& date, const double age, std::string o
...
@@ -14,6 +14,18 @@ IRes::IRes(const Vect6& vec, const TimeJD& date, const double age, std::string o
{
{
}
}
IRes
::
IRes
(
const
Vect6
&
vec
,
const
Vect3
&
rnb
,
const
TimeJD
&
date
,
double
age
,
std
::
string
orbitid
,
bool
addon
)
:
m_orbitid
(
std
::
move
(
orbitid
)),
m_vec
(
vec
),
m_rnb
(
rnb
),
m_date
(
date
),
m_age
(
age
),
m_addon
(
addon
),
m_has_rnb
(
true
)
{
}
void
IRes
::
load
(
const
jsonval
&
parent
)
void
IRes
::
load
(
const
jsonval
&
parent
)
{
{
double
x
,
y
,
z
;
double
x
,
y
,
z
;
...
...
utils/ires.h
View file @
038eaefb
...
@@ -5,19 +5,25 @@
...
@@ -5,19 +5,25 @@
#include <string>
#include <string>
#include "json_functions.h"
#include "json_functions.h"
class
IRes
{
class
IRes
{
public
:
public
:
IRes
();
IRes
();
IRes
(
const
Vect6
&
vec
,
const
TimeJD
&
date
,
double
age
,
std
::
string
orbitid
,
bool
addon
=
false
);
IRes
(
const
Vect6
&
vec
,
const
TimeJD
&
date
,
double
age
,
std
::
string
orbitid
,
bool
addon
=
false
);
IRes
(
const
Vect6
&
vec
,
const
Vect3
&
rnb
,
const
TimeJD
&
date
,
double
age
,
std
::
string
orbitid
,
bool
addon
=
false
);
void
load
(
const
jsonval
&
parent
);
void
load
(
const
jsonval
&
parent
);
TimeJD
get_date
()
const
{
return
m_date
;
}
TimeJD
get_date
()
const
{
return
m_date
;
}
Vect6
get_pos
()
const
{
return
m_vec
;
}
const
Vect6
&
get_pos
()
const
{
return
m_vec
;
}
const
Vect3
&
get_rnb
()
const
{
return
m_rnb
;
}
bool
is_addon
()
const
{
return
m_addon
;
}
bool
is_addon
()
const
{
return
m_addon
;
}
double
get_age
()
const
{
return
m_age
;
}
double
get_age
()
const
{
return
m_age
;
}
bool
has_rnb
()
const
{
return
m_has_rnb
;
}
private
:
private
:
std
::
string
m_orbitid
;
std
::
string
m_orbitid
;
Vect6
m_vec
;
Vect6
m_vec
;
Vect3
m_rnb
;
TimeJD
m_date
;
TimeJD
m_date
;
double
m_age
;
double
m_age
;
bool
m_addon
;
bool
m_addon
;
bool
m_has_rnb
{
false
};
};
};
utils/orbBlock.cpp
View file @
038eaefb
...
@@ -60,7 +60,7 @@ void OrbBlock::init_by_orbit(const bool calc_rnb)
...
@@ -60,7 +60,7 @@ void OrbBlock::init_by_orbit(const bool calc_rnb)
void
OrbBlock
::
init_by_data
()
void
OrbBlock
::
init_by_data
()
{
{
m_ip
=
new
XInterpolator
(
m_data
.
get_vecs
()
,
m_data
.
get_rnb
()
);
m_ip
=
new
XInterpolator
(
m_data
.
get_vecs
());
}
}
void
OrbBlock
::
load
(
const
jsonval
&
parent
)
void
OrbBlock
::
load
(
const
jsonval
&
parent
)
...
...
utils/orb_block_data.h
View file @
038eaefb
...
@@ -37,7 +37,6 @@ public:
...
@@ -37,7 +37,6 @@ public:
const
std
::
string
&
get_next_orbitid
()
const
{
return
m_next_orbitid
;
}
const
std
::
string
&
get_next_orbitid
()
const
{
return
m_next_orbitid
;
}
double
get_min_distance
()
const
{
return
m_mind
;
}
double
get_min_distance
()
const
{
return
m_mind
;
}
const
std
::
vector
<
IRes
>&
get_vecs
()
const
{
return
m_vecs
;
}
const
std
::
vector
<
IRes
>&
get_vecs
()
const
{
return
m_vecs
;
}
const
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>&
get_rnb
()
const
{
return
m_rnb
;
}
private
:
private
:
std
::
string
m_orbitid
;
std
::
string
m_orbitid
;
std
::
string
m_next_orbitid
;
std
::
string
m_next_orbitid
;
...
@@ -46,5 +45,4 @@ private:
...
@@ -46,5 +45,4 @@ private:
TimeJD
m_end
;
TimeJD
m_end
;
double
m_mind
;
double
m_mind
;
std
::
vector
<
IRes
>
m_vecs
;
std
::
vector
<
IRes
>
m_vecs
;
std
::
vector
<
std
::
tuple
<
double
,
double
,
double
>>
m_rnb
;
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment