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
14da93c9
Commit
14da93c9
authored
May 29, 2019
by
Alexander Lapshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
44857c88
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
20 deletions
+75
-20
RAzGammaCoords.cpp
bnolib/RAzGammaCoords.cpp
+1
-1
TimeFunctions.h
utils/TimeFunctions.h
+10
-0
interpolate.cpp
utils/interpolate.cpp
+4
-2
orbBlock.h
utils/orbBlock.h
+1
-0
orbBlocks.cpp
utils/orbBlocks.cpp
+41
-12
orbBlocks.h
utils/orbBlocks.h
+1
-0
orb_date.cpp
utils/orb_date.cpp
+17
-5
No files found.
bnolib/RAzGammaCoords.cpp
View file @
14da93c9
...
...
@@ -21,7 +21,7 @@ void RAzGammaCoords::SetXYZ(const Vect3 &src)
Dist
=
src
.
Len
();
Az
=
atan2
(
src
.
z
,
src
.
x
);
Gamma
=
asin
(
src
.
y
/
Dist
)
;
Gamma
=
Dist
!=
0
?
asin
(
src
.
y
/
Dist
)
:
0
;
// Az = atan2(src.y, src.x);
// Gamma = asin(src.z / Dist);
...
...
utils/TimeFunctions.h
View file @
14da93c9
...
...
@@ -258,11 +258,21 @@ static double DaysInterval(const TimeGD& date1, const TimeGD& date2)
return
diff
.
Day
().
GetDouble
();
}
static
double
SecInterval
(
const
TimeGD
&
date1
,
const
TimeGD
&
date2
)
{
return
DaysInterval
(
date1
,
date2
)
*
86400
;
}
static
double
DaysInterval
(
const
TimeJD
&
date1
,
const
TimeJD
&
date2
)
{
return
(
date2
-
date1
).
Day
().
GetDouble
();
}
static
double
SecInterval
(
const
TimeJD
&
date1
,
const
TimeJD
&
date2
)
{
return
DaysInterval
(
date1
,
date2
)
*
86400
;
}
static
void
DegToDMS
(
double
deg
,
int
&
rd
,
int
&
rm
,
double
&
rs
)
{
if
(
deg
<
0
)
{
...
...
utils/interpolate.cpp
View file @
14da93c9
...
...
@@ -93,8 +93,10 @@ void XInterpolator::propagate(const SInitOrbit& orbit, const TimeJD& beg, const
propagate_dir
(
orbit
,
ShiftDate
(
orbit
.
GetDate
(),
+
get_step
(
orbit
)
/
2.0
),
end
,
+
1
,
result
);
propagate_dir
(
orbit
,
ShiftDate
(
orbit
.
GetDate
(),
-
get_step
(
orbit
)
/
2.0
),
beg
,
-
1
,
result
);
}
std
::
sort
(
result
.
begin
(),
result
.
end
(),
cmppos
<
false
,
IRes
>
());
std
::
sort
(
result
.
begin
(),
result
.
end
(),
[](
const
IRes
&
a
,
const
IRes
&
b
)
{
return
a
.
get_date
()
<
b
.
get_date
();
});
}
void
XInterpolator
::
calc_positions
(
const
SInitOrbit
&
orbit
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
std
::
vector
<
IRes
>&
result
)
...
...
utils/orbBlock.h
View file @
14da93c9
...
...
@@ -15,6 +15,7 @@ public:
TimeJD
get_end
()
const
{
return
m_end
;
}
const
SInitOrbit
&
get_orbit
()
const
{
return
m_orbit
;
}
double
get_min_distance
()
const
{
return
m_mind
;
}
std
::
string
get_next_orbitid
()
const
{
return
m_next_orbitid
;}
void
interpolate
(
const
TimeJD
&
beg
,
const
TimeJD
&
end
);
const
XInterpolator
*
get_interpolator
()
const
{
return
m_ip
;
}
private
:
...
...
utils/orbBlocks.cpp
View file @
14da93c9
...
...
@@ -2,17 +2,7 @@
#include "TimeFunctions.h"
#include "Propagator.h"
#include "xalgorithm.h"
template
<
bool
dir
,
typename
vartype
>
struct
cmporb
:
public
std
::
binary_function
<
vartype
,
vartype
,
bool
>
{
bool
operator
()(
vartype
s1
,
vartype
s2
)
const
{
const
TimeJD
&
v1
=
s1
.
GetDate
();
const
TimeJD
&
v2
=
s2
.
GetDate
();
return
(
v1
==
v2
)
?
false
:
(
v1
<
v2
)
^
dir
;
}
};
#include "orb_date.h"
OrbBlocksStore
::
OrbBlocksStore
()
{
...
...
@@ -21,7 +11,10 @@ OrbBlocksStore::OrbBlocksStore()
void
OrbBlocksStore
::
init
(
const
SInitOrbits
&
orbits
,
const
TimeJD
*
beg
,
const
TimeJD
*
end
,
bool
filter_orbits
,
bool
min_dist_forced
,
bool
interpolate
)
{
SInitOrbits
sordet_orbits
=
orbits
;
std
::
sort
(
sordet_orbits
.
begin
(),
sordet_orbits
.
end
(),
cmporb
<
false
,
SInitOrbit
>
());
std
::
sort
(
sordet_orbits
.
begin
(),
sordet_orbits
.
end
(),
[](
const
SInitOrbit
&
a
,
const
SInitOrbit
&
b
)
{
return
a
.
GetDate
()
<
b
.
GetDate
();
});
m_beg_before_filter
=
beg
?
*
beg
:
sordet_orbits
.
front
().
GetDate
();
m_end_before_filter
=
end
?
*
end
:
sordet_orbits
.
back
().
GetDate
();
...
...
@@ -256,3 +249,39 @@ const SInitOrbit& OrbBlocksStore::get_orbit(const TimeJD& date) const
throw
(
Exp
()
<<
"no orbit found"
);
}
SInitOrbits
OrbBlocksStore
::
calc_orbits
(
std
::
vector
<
TimeJD
>
dates
,
bool
variates
)
const
{
std
::
sort
(
dates
.
begin
(),
dates
.
end
(),
[](
const
TimeJD
&
a
,
const
TimeJD
&
b
)
{
return
a
<
b
;
});
SInitOrbits
result
;
result
.
reserve
(
dates
.
size
());
size_t
j
=
0
;
for
(
auto
const
&
block
:
get_blocks
())
{
std
::
vector
<
TimeJD
>
b_dates
;
for
(
size_t
i
=
j
;
i
<
dates
.
size
();
i
++
)
{
const
TimeJD
&
date
=
dates
[
i
];
if
(
date
>=
block
.
get_beg
()
&&
date
<=
block
.
get_end
())
{
b_dates
.
push_back
(
date
);
}
else
if
(
date
>
block
.
get_end
())
{
j
=
i
;
break
;
}
}
if
(
b_dates
.
empty
())
{
continue
;
}
std
::
vector
<
SInitOrbit
>
orbits
=
calc_orbits_on_dates
(
block
.
get_orbit
(),
b_dates
,
variates
);
result
.
insert
(
result
.
end
(),
orbits
.
begin
(),
orbits
.
end
());
}
return
result
;
}
utils/orbBlocks.h
View file @
14da93c9
...
...
@@ -13,6 +13,7 @@ public:
OrbBlocksStore
();
void
init
(
const
SInitOrbits
&
orbits
,
const
TimeJD
*
beg
,
const
TimeJD
*
end
,
bool
filter_orbits
,
bool
min_dist_forced
,
bool
interpolate
);
void
init
(
const
SInitOrbits
&
orbits
,
const
TimeJD
&
beg
,
const
TimeJD
&
end
,
bool
filter_orbits
,
bool
min_dist_forced
,
bool
interpolate
);
SInitOrbits
calc_orbits
(
std
::
vector
<
TimeJD
>
dates
,
bool
variates
)
const
;
Vect6
get_pos
(
const
TimeJD
&
date
)
const
;
const
SInitOrbit
&
get_orbit
(
const
TimeJD
&
date
)
const
;
const
OrbBlocks
&
get_blocks
()
const
{
return
m_blocks
;
}
...
...
utils/orb_date.cpp
View file @
14da93c9
...
...
@@ -112,14 +112,18 @@ void split_dates(const std::vector<TimeJD>& dates, const TimeJD& date, std::vect
}
}
template
<
typename
T
>
void
calc_orbit_on_dates
(
const
SInitOrbit
&
orbit
,
const
std
::
vector
<
TimeJD
>&
dates
,
bool
variates
,
std
::
vector
<
T
>&
result
)
template
<
typename
T
>
void
calc_orbit_on_dates
(
const
SInitOrbit
&
orbit
,
std
::
vector
<
TimeJD
>
dates
,
bool
variates
,
std
::
vector
<
T
>&
result
)
{
if
(
dates
.
empty
())
{
return
;
}
TimeJD
beg_ext
=
dates
.
front
();
TimeJD
end_ext
=
dates
.
back
();
std
::
sort
(
dates
.
begin
(),
dates
.
end
(),
[](
const
TimeJD
&
a
,
const
TimeJD
&
b
)
{
return
a
<
b
;
});
const
TimeJD
&
beg_ext
=
dates
.
front
();
const
TimeJD
&
end_ext
=
dates
.
back
();
if
(
orbit
.
GetDate
()
<=
beg_ext
)
{
propagate_dir
(
orbit
,
dates
,
1
,
variates
,
result
);
...
...
@@ -149,7 +153,11 @@ std::vector<IRes> calc_positions_on_dates(const SInitOrbit& orbit, const std::ve
{
std
::
vector
<
IRes
>
result
;
calc_orbit_on_dates
(
orbit
,
dates
,
false
,
result
);
std
::
sort
(
result
.
begin
(),
result
.
end
(),
cmppos
<
false
,
IRes
>
());
std
::
sort
(
result
.
begin
(),
result
.
end
(),
[](
const
IRes
&
a
,
const
IRes
&
b
)
{
return
a
.
get_date
()
<
b
.
get_date
();
});
return
result
;
}
...
...
@@ -157,6 +165,10 @@ std::vector<SInitOrbit> calc_orbits_on_dates(const SInitOrbit& orbit, const std:
{
std
::
vector
<
SInitOrbit
>
result
;
calc_orbit_on_dates
(
orbit
,
dates
,
variates
,
result
);
std
::
sort
(
result
.
begin
(),
result
.
end
(),
cmporb
<
false
,
SInitOrbit
>
());
std
::
sort
(
result
.
begin
(),
result
.
end
(),
[](
const
SInitOrbit
&
a
,
const
SInitOrbit
&
b
)
{
return
a
.
GetDate
()
<
b
.
GetDate
();
});
return
result
;
}
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