Commit 6969ff1e authored by Alexander Lapshin's avatar Alexander Lapshin

.

parent 636205b8
#ifndef ORBITID_H
#define ORBITID_H
#include <string>
typedef std::string TOrbitId;
#endif
......@@ -65,28 +65,22 @@ void XInterpolator::propagate_dir(const SInitOrbit& orbit, const TimeJD& beg, co
{
Propagator prop(orbit, false);
int step = get_step(orbit);
//std::string s_beg = DateToStr(beg);
//std::string s_end = DateToStr(end);
bool exit = false;
TimeJD date = beg;
while (!exit) {
//std::string s_date = DateToStr(date);
if (date >= end && dir == 1 || date <= end && dir == -1) {
date = end;
exit = true;
}
double age = DaysInterval(orbit.GetDate(), date);
PhasePoint6D pos;
prop.Propagate(date, pos);
result.push_back(IRes(pos.CoordsVel, date, step));
result.push_back(IRes(pos.CoordsVel, date, step, age, orbit.GetId()));
date = ShiftDate(date, dir * step);
//double age = DaysInterval(prop.GetInitOrbit().GetDate(), date);
//std::cout << age << "\n";
//int c=8;
}
}
......@@ -107,6 +101,7 @@ void XInterpolator::calc_positions(const SInitOrbit& orbit, const TimeJD& beg, c
{
int n = 100;
int step = get_step(orbit);
TimeJD beg_ext = ShiftDate(beg, -n * step);
TimeJD end_ext = ShiftDate(end, +n * step);
......
......@@ -12,14 +12,14 @@ public:
XInterpolator();
XInterpolator(const SInitOrbit& orbit, const TimeJD& beg, const TimeJD& end);
~XInterpolator();
void create(const SInitOrbit& orbit, const TimeJD& beg, const TimeJD& end);
Vect6 get_pos(const TimeJD& date) const;
int get_size() const { return m_positions.size(); }
TimeJD get_beg() const { return m_beg; }
TimeJD get_end() const { return m_end; }
const SInitOrbit& get_orbit() const { return m_orbit; }
private:
static void calc_positions(const SInitOrbit& orbit, const TimeJD& beg, const TimeJD& end, std::vector<IRes>& result);
private:
void create(const SInitOrbit& orbit, const TimeJD& beg, const TimeJD& end);
static void propagate(const SInitOrbit& orbit, const TimeJD& beg, const TimeJD& end, int dir, std::vector<IRes>& result);
static void propagate_dir(const SInitOrbit& orbit, const TimeJD& beg, const TimeJD& end, int dir, std::vector<IRes>& result);
//void filter_addons();
......
#include "ires.h"
IRes::IRes(Vect6 vec, const TimeJD& date, int step, bool addon)
IRes::IRes(Vect6 vec, const TimeJD& date, int step, double age, TOrbitId orbitid, bool addon)
:
m_vec(vec),
m_date(date),
m_step(step),
m_age(age),
m_orbitid(orbitid),
m_addon(addon)
{
}
......@@ -2,18 +2,21 @@
#include "DVectors.h"
#include "TM.h"
#include "OrbitId.h"
class IRes {
public:
IRes() {};
IRes(Vect6 vec, const TimeJD& date, int step, bool addon = false);
IRes(Vect6 vec, const TimeJD& date, int step, double age, TOrbitId orbitid, bool addon = false);
TimeJD get_date() const { return m_date; }
Vect6 get_pos() const { return m_vec; }
int get_step() const { return m_step; }
bool is_addon() const { return m_addon; }
private:
TOrbitId m_orbitid;
Vect6 m_vec;
TimeJD m_date;
int m_step;
double m_age;
bool m_addon;
};
......@@ -42,25 +42,14 @@ SInitOrbits OrbBlocksStore::filter(SInitOrbits orbits) const
TimeJD orb1beg = ShiftDate(orb1.GetDate(), -orb1.GetInterval() * 86400);
const TimeJD& orb1end = orb1.GetDate();
//std::string orb1beg_s = DateToStr(orb1beg);
//std::string orb1end_s = DateToStr(orb1end);
/*if (i == orbits.size() - 1){
//result.push_back(orb1);
break;
}*/
bool found = false;
for (int j = i + 1; j < (int)orbits.size(); j++) {
const SInitOrbit& orb2 = orbits[j];
TimeJD orb2beg = ShiftDate(orb2.GetDate(), -orb2.GetInterval() * 86400);
const TimeJD& orb2end = orb2.GetDate();
//std::string orb2beg_s = DateToStr(orb2beg);
//std::string orb2end_s = DateToStr(orb2end);
bool eq1 = fabs(DaysInterval(orb1beg, orb2beg) * 86400 * 1000) < 1;
bool eq2 = fabs(DaysInterval(orb1end, orb2end) * 86400 * 1000) < 1;
......@@ -98,10 +87,7 @@ void OrbBlocksStore::init_min_dist(const SInitOrbits& orbits, const TimeJD& beg,
{
TimeJD left = beg;
bool stop = false;
// std::string beg_s = DateToStr(beg);
// std::string end_s = DateToStr(end);
for (int i = 0; i < (int)orbits.size() && !stop; i++) {
const SInitOrbit& orb1 = orbits[i];
......@@ -113,11 +99,7 @@ void OrbBlocksStore::init_min_dist(const SInitOrbits& orbits, const TimeJD& beg,
m_blocks.push_back(OrbBlock(orb1, left, end));
break;
}
//std::string orb1beg_s = DateToStr(orb1beg);
//std::string orb1end_s = DateToStr(orb1end);
//std::string left_s = DateToStr(left);
if (orb1end < left) {
continue;
}
......@@ -125,10 +107,7 @@ void OrbBlocksStore::init_min_dist(const SInitOrbits& orbits, const TimeJD& beg,
const SInitOrbit& orb2 = orbits[i + 1];
TimeJD orb2beg = ShiftDate(orb2.GetDate(), -orb2.GetInterval() * 86400);
//std::string orb2beg_s = DateToStr(orb2beg);
//std::string orb2end_s = DateToStr(orb2end);
if (orb1end < orb2beg) {
//no intersection
if (orb2beg < left) {
......@@ -139,7 +118,7 @@ void OrbBlocksStore::init_min_dist(const SInitOrbits& orbits, const TimeJD& beg,
TimeJD right;
double minDist;
calc_min_dist(orb1, orb2, orb1end, orb2beg, right, minDist);
//std::string minjd_s = DateToStr(right);
if (right > end) {
right = end;
stop = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment