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
cbaaa495
Commit
cbaaa495
authored
Oct 08, 2018
by
Alexander Lapshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
76023efb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
392 additions
and
313 deletions
+392
-313
BNOAstroBase.cpp
bnolib/BNOAstroBase.cpp
+33
-33
IModel.h
bnolib/IModel.h
+78
-76
ODESystem.cpp
bnolib/ODESystem.cpp
+23
-12
ODESystem.h
bnolib/ODESystem.h
+0
-1
SGravity.h
bnolib/SGravity.h
+173
-103
ephemeris.cpp
bnolib/ephemeris.cpp
+84
-83
TextFunctions.h
utils/TextFunctions.h
+1
-1
interpolate.cpp
utils/interpolate.cpp
+0
-4
No files found.
bnolib/BNOAstroBase.cpp
View file @
cbaaa495
...
@@ -660,43 +660,43 @@ void BNOAstroBase::GetPosGelio(TPlanetId pl, const TimeJD &t, Vect3 *crd, Vect3
...
@@ -660,43 +660,43 @@ void BNOAstroBase::GetPosGelio(TPlanetId pl, const TimeJD &t, Vect3 *crd, Vect3
}
}
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//
//
void
BNOAstroBase
::
GetPosGeo
(
TPlanetId
pl
,
const
TimeJD
&
t
,
Vect3
*
crd
,
Vect3
*
vel
,
void
BNOAstroBase
::
GetPosGeo
(
TPlanetId
pl
,
const
TimeJD
&
t
,
Vect3
*
crd
,
Vect3
*
vel
,
Vect3
*
acc
)
const
Vect3
*
acc
)
const
{
{
if
(
pl
==
plIdEarth
||
pl
==
plIdMoon
)
if
(
pl
==
plIdEarth
||
pl
==
plIdMoon
)
{
{
const
IEphemeride
*
iph
=
GetPlanet
(
pl
)
->
GetEphemeride
();
const
IEphemeride
*
iph
=
GetPlanet
(
pl
)
->
GetEphemeride
();
TAssert
(
iph
->
GetCS
()
==
csIdJ2000
);
TAssert
(
iph
->
GetCS
()
==
csIdJ2000
);
iph
->
GetPosition
(
t
,
crd
,
vel
,
acc
);
iph
->
GetPosition
(
t
,
crd
,
vel
,
acc
);
}
}
else
else
{
{
Vect3
cem
,
vem
,
aem
;
Vect3
cem
,
vem
,
aem
;
Vect3
cm
,
vm
,
am
;
Vect3
cm
,
vm
,
am
;
Vect3
cs
,
vs
,
as
;
Vect3
cs
,
vs
,
as
;
GetPosGelio
(
pl
,
t
,
crd
,
vel
,
acc
);
GetPosGelio
(
pl
,
t
,
crd
,
vel
,
acc
);
GetPosGelio
(
plIdEarthMoon
,
t
,
crd
==
NULL
?
NULL
:
&
cem
,
vel
==
NULL
?
NULL
:
&
vem
,
GetPosGelio
(
plIdEarthMoon
,
t
,
crd
==
NULL
?
NULL
:
&
cem
,
vel
==
NULL
?
NULL
:
&
vem
,
acc
==
NULL
?
NULL
:
&
aem
);
acc
==
NULL
?
NULL
:
&
aem
);
GetPosGeo
(
plIdMoon
,
t
,
crd
==
NULL
?
NULL
:
&
cm
,
vel
==
NULL
?
NULL
:
&
vm
,
GetPosGeo
(
plIdMoon
,
t
,
crd
==
NULL
?
NULL
:
&
cm
,
vel
==
NULL
?
NULL
:
&
vm
,
acc
==
NULL
?
NULL
:
&
am
);
acc
==
NULL
?
NULL
:
&
am
);
if
(
crd
!=
NULL
)
if
(
crd
!=
NULL
)
{
{
GetGelio2GeoShift
(
cem
,
cm
,
cs
);
GetGelio2GeoShift
(
cem
,
cm
,
cs
);
(
*
crd
)
+=
cs
;
(
*
crd
)
+=
cs
;
}
}
if
(
vel
!=
NULL
)
if
(
vel
!=
NULL
)
{
{
GetGelio2GeoShift
(
vem
,
vm
,
vs
);
GetGelio2GeoShift
(
vem
,
vm
,
vs
);
(
*
vel
)
+=
vs
;
(
*
vel
)
+=
vs
;
}
}
if
(
acc
!=
NULL
)
if
(
acc
!=
NULL
)
{
{
GetGelio2GeoShift
(
aem
,
am
,
as
);
GetGelio2GeoShift
(
aem
,
am
,
as
);
(
*
acc
)
+=
as
;
(
*
acc
)
+=
as
;
}
}
}
}
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//
//
bool
BNOAstroBase
::
Init
(
bool
noAtm
,
bool
loadPlanets
)
bool
BNOAstroBase
::
Init
(
bool
noAtm
,
bool
loadPlanets
)
...
...
bnolib/IModel.h
View file @
cbaaa495
...
@@ -11,130 +11,132 @@
...
@@ -11,130 +11,132 @@
#include "DVectors.h"
#include "DVectors.h"
#include "Ids.h"
#include "Ids.h"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// ,
// ,
//
//
class
IEphemeride
class
IEphemeride
{
{
public
:
public
:
//
//
virtual
~
IEphemeride
()
virtual
~
IEphemeride
()
{}
;
{}
;
//
//
virtual
bool
LoadData
(
const
TimeJD
&
s
,
const
TimeJD
&
e
)
=
0
;
virtual
bool
LoadData
(
const
TimeJD
&
s
,
const
TimeJD
&
e
)
=
0
;
//
//
virtual
void
UnLoadData
()
=
0
;
virtual
void
UnLoadData
()
=
0
;
// .
// .
virtual
void
GetPosition
(
const
TimeJD
&
t
,
Vect3
*
pos
=
NULL
,
virtual
void
GetPosition
(
const
TimeJD
&
t
,
Vect3
*
pos
=
NULL
,
Vect3
*
vel
=
NULL
,
Vect3
*
acc
=
NULL
)
const
=
0
;
Vect3
*
vel
=
NULL
,
Vect3
*
acc
=
NULL
)
const
=
0
;
//
//
virtual
TCoordSysId
GetCS
()
const
=
0
;
virtual
TCoordSysId
GetCS
()
const
=
0
;
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
//
class
TGeometryModel
class
TGeometryModel
{
{
public
:
public
:
double
Re
;
//
double
Re
;
//
double
alpha
;
//
double
alpha
;
//
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
//
class
IAtmosphereModel
class
IAtmosphereModel
{
{
public
:
public
:
// .
// .
virtual
~
IAtmosphereModel
()
virtual
~
IAtmosphereModel
()
{}
;
{};
// .
// .
//
//
virtual
double
Density
(
const
TimeJD
&
t
,
const
Vect3
&
v
,
const
Vect3
&
vSun
)
virtual
double
Density
(
const
TimeJD
&
t
,
const
Vect3
&
v
,
const
Vect3
&
vSun
)
const
=
0
;
const
=
0
;
//
//
virtual
TAtmosphereId
GetID
()
const
=
0
;
virtual
TAtmosphereId
GetID
()
const
=
0
;
// ?
// ?
virtual
bool
IsSunPosNeed
()
const
=
0
;
virtual
bool
IsSunPosNeed
()
const
=
0
;
// ?
// ?
virtual
bool
IsTableNeed
()
const
=
0
;
virtual
bool
IsTableNeed
()
const
=
0
;
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// ,
// ,
class
TGeoSolarFlux
class
TGeoSolarFlux
{
{
public
:
public
:
double
f135
;
// 135 - 77
double
f135
;
// 135 - 77
double
f90
;
// 90 - ???
double
f90
;
// 90 - ???
double
f81
;
// 81 - ???
double
f81
;
// 81 - ???
double
f135w
;
// 135
double
f135w
;
// 135
double
f81w
;
// 81 - 90
double
f81w
;
// 81 - 90
double
f01
;
// 1 -
double
f01
;
// 1 -
double
kp
;
// ( )
double
kp
;
// ( )
int
ap
;
//
int
ap
;
//
double
three_hours_kp
[
8
];
//
double
three_hours_kp
[
8
];
//
bool
iskp3
;
bool
iskp3
;
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
//
class
ITableGeoSolarFlux
class
ITableGeoSolarFlux
{
{
public
:
public
:
//
//
virtual
~
ITableGeoSolarFlux
()
virtual
~
ITableGeoSolarFlux
()
{}
;
{}
;
//
//
virtual
const
TGeoSolarFlux
*
Get_F107
(
const
TimeJD
&
tm
)
const
=
0
;
virtual
const
TGeoSolarFlux
*
Get_F107
(
const
TimeJD
&
tm
)
const
=
0
;
//
//
virtual
const
double
*
Get_Kp3hour
(
const
TimeJD
&
tm
)
const
=
0
;
virtual
const
double
*
Get_Kp3hour
(
const
TimeJD
&
tm
)
const
=
0
;
//
//
virtual
double
Get_Kp3hourMod
(
const
TimeJD
&
tm
)
const
=
0
;
virtual
double
Get_Kp3hourMod
(
const
TimeJD
&
tm
)
const
=
0
;
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
//
class
IGravityModel
class
IGravityModel
{
{
public
:
public
:
//
//
virtual
~
IGravityModel
()
virtual
~
IGravityModel
()
{}
;
{};
//
//
virtual
double
c
(
unsigned
int
n
,
unsigned
int
m
)
const
=
0
;
virtual
double
c
(
unsigned
int
n
,
unsigned
int
m
)
const
=
0
;
virtual
double
d
(
unsigned
int
n
,
unsigned
int
m
)
const
=
0
;
virtual
double
d
(
unsigned
int
n
,
unsigned
int
m
)
const
=
0
;
//
//
virtual
unsigned
int
N
()
const
=
0
;
virtual
unsigned
int
N
()
const
=
0
;
virtual
unsigned
int
M
()
const
=
0
;
virtual
unsigned
int
M
()
const
=
0
;
//
//
virtual
TGravityModelId
GetID
()
const
=
0
;
virtual
TGravityModelId
GetID
()
const
=
0
;
virtual
const
double
*
const
*
get_cc
()
const
{
return
0
;
}
virtual
const
double
*
const
*
get_dd
()
const
{
return
0
;
}
double
mu
;
//
double
mu
;
//
double
Re
;
//
double
Re
;
//
double
alpha
;
//
double
alpha
;
//
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
//
class
IPlanet
class
IPlanet
{
{
public
:
public
:
//
//
IPlanet
()
IPlanet
()
{};
{};
//
//
virtual
~
IPlanet
()
virtual
~
IPlanet
()
{};
{};
//
//
virtual
const
char
*
Name
()
const
=
0
;
virtual
const
char
*
Name
()
const
=
0
;
//
//
virtual
TPlanetId
Id
()
const
=
0
;
virtual
TPlanetId
Id
()
const
=
0
;
//
//
virtual
const
IGravityModel
*
GetGravityModel
()
const
=
0
;
virtual
const
IGravityModel
*
GetGravityModel
()
const
=
0
;
//
//
virtual
const
IAtmosphereModel
*
GetAtmosphere
()
const
=
0
;
virtual
const
IAtmosphereModel
*
GetAtmosphere
()
const
=
0
;
//
//
virtual
IEphemeride
*
GetEphemeride
()
=
0
;
virtual
IEphemeride
*
GetEphemeride
()
=
0
;
virtual
const
IEphemeride
*
GetEphemeride
()
const
=
0
;
virtual
const
IEphemeride
*
GetEphemeride
()
const
=
0
;
double
omega
;
//
double
omega
;
//
double
RShad
;
//
double
RShad
;
//
TGeometryModel
Geometry
;
TGeometryModel
Geometry
;
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#endif
#endif
bnolib/ODESystem.cpp
View file @
cbaaa495
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
#include "ODESystem.h"
#include "ODESystem.h"
#include "GeoCoords.h"
#include "GeoCoords.h"
#include "IAstroBase.h"
#include "IAstroBase.h"
#include "EarthGravity.h"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
//
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
...
@@ -197,7 +199,7 @@ bool ODEPhaseSystem::GetRP(double t, const double *ph, double *f)
...
@@ -197,7 +199,7 @@ bool ODEPhaseSystem::GetRP(double t, const double *ph, double *f)
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void
ODEPhaseSystem
::
EarthNonCentralAcc
(
Vect3
&
acc
,
const
Vect3
&
pos
)
void
ODEPhaseSystem
::
EarthNonCentralAcc
(
Vect3
&
acc
,
const
Vect3
&
pos
)
{
{
double
r
=
pos
.
Len
();
double
r
=
pos
.
Len
();
double
ro
=
EarthGravity
->
Re
/
r
;
double
ro
=
EarthGravity
->
Re
/
r
;
double
xr
=
pos
.
x
/
r
;
double
xr
=
pos
.
x
/
r
;
double
yr
=
pos
.
y
/
r
;
double
yr
=
pos
.
y
/
r
;
...
@@ -215,19 +217,23 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
...
@@ -215,19 +217,23 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
double
x2
=
0
;
double
x2
=
0
;
double
p0
=
p0_1
;
double
p0
=
p0_1
;
double
cn0
,
t1
;
double
cn0
,
t1
;
const
double
*
const
*
CC
=
EarthGravity
->
get_cc
();
const
double
*
const
*
DD
=
EarthGravity
->
get_dd
();
int
n
;
int
n
;
for
(
n
=
2
;
n
<=
Ng
;
n
++
)
for
(
n
=
2
;
n
<=
Ng
;
n
++
)
{
{
ro1
*=
ro
;
ro1
*=
ro
;
Ron
[
n
]
=
ro1
;
Ron
[
n
]
=
ro1
;
cn0
=
EarthGravity
->
c
(
n
,
0
)
*
ro1
;
//cn0 = EarthGravity->c(n, 0) * ro1;
x0
+=
cn0
*
(
n
+
1
)
*
p0
;
cn0
=
CC
[
0
][
n
]
*
ro1
;
x0
+=
cn0
*
(
n
+
1
)
*
p0
;
x2
+=
cn0
*
Pm
[
n
];
x2
+=
cn0
*
Pm
[
n
];
if
(
n
==
Ng
)
if
(
n
==
Ng
)
break
;
break
;
t1
=
(
2
*
n
+
1
)
*
zr
;
t1
=
(
2
*
n
+
1
)
*
zr
;
Pm
[
n
+
1
]
=
(
t1
*
Pm
[
n
]
-
(
n
+
1
)
*
Pm
[
n
-
1
])
/
n
;
Pm
[
n
+
1
]
=
(
t1
*
Pm
[
n
]
-
(
n
+
1
)
*
Pm
[
n
-
1
])
/
n
;
p0
=
(
t1
*
p0_1
-
n
*
p0_2
)
/
(
n
+
1
);
p0
=
(
t1
*
p0_1
-
n
*
p0_2
)
/
(
n
+
1
);
p0_2
=
p0_1
;
p0_2
=
p0_1
;
p0_1
=
p0
;
p0_1
=
p0
;
...
@@ -244,7 +250,7 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
...
@@ -244,7 +250,7 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
double
z12
=
0
;
double
z12
=
0
;
int
m
;
int
m
;
double
cm
=
0.0
,
sm
=
0.0
,
cc
;
double
cm
=
0.0
,
sm
=
0.0
,
cc
;
for
(
m
=
1
;
m
<=
Mg
;
m
++
)
for
(
m
=
1
;
m
<=
Mg
;
m
++
)
{
{
double
x01
=
0
;
double
x01
=
0
;
...
@@ -260,14 +266,19 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
...
@@ -260,14 +266,19 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
n
=
m
<
2
?
2
:
m
;
n
=
m
<
2
?
2
:
m
;
const
double
*
pn
=
Nm1
;
const
double
*
pn
=
Nm1
;
for
(;
n
<=
Mg
;
n
++
)
for
(;
n
<=
Mg
;
n
++
)
{
{
t1
=
Ron
[
n
];
t1
=
Ron
[
n
];
double
cnm
=
EarthGravity
->
c
(
n
,
m
)
*
t1
;
double
dnm
=
EarthGravity
->
d
(
n
,
m
)
*
t1
;
t1
=
Pm
[
n
];
//double cnm = EarthGravity->c(n, m) * t1;
double
cnm
=
CC
[
m
][
n
]
*
t1
;
//double dnm = EarthGravity->d(n, m) * t1;
double
dnm
=
DD
[
m
][
n
]
*
t1
;
t1
=
Pm
[
n
];
double
t2
=
cnm
*
t1
;
double
t2
=
cnm
*
t1
;
x11
+=
t2
;
x11
+=
t2
;
t1
*=
dnm
;
t1
*=
dnm
;
...
@@ -310,7 +321,7 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
...
@@ -310,7 +321,7 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
// ???
// ???
double
*
Pmt
=
Pm
;
double
*
Pmt
=
Pm
;
Pm
=
Pm1
;
Pm
=
Pm1
;
Pm1
=
Pmt
;
Pm1
=
Pmt
;
};
};
...
@@ -319,7 +330,7 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
...
@@ -319,7 +330,7 @@ void ODEPhaseSystem::EarthNonCentralAcc(Vect3 &acc, const Vect3 &pos)
acc
.
x
=
x11
*
(
z11
-
xr
*
x01
);
acc
.
x
=
x11
*
(
z11
-
xr
*
x01
);
acc
.
y
=
x11
*
(
z12
-
yr
*
x01
);
acc
.
y
=
x11
*
(
z12
-
yr
*
x01
);
acc
.
z
=
x11
*
(
z2
-
zr
*
x01
);
acc
.
z
=
x11
*
(
z2
-
zr
*
x01
);
// . J2000
// . J2000
...
...
bnolib/ODESystem.h
View file @
cbaaa495
...
@@ -110,4 +110,3 @@ class ODEVarSystem : public ODEPhaseSystem
...
@@ -110,4 +110,3 @@ class ODEVarSystem : public ODEPhaseSystem
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#endif
#endif
bnolib/SGravity.h
View file @
cbaaa495
...
@@ -11,157 +11,227 @@
...
@@ -11,157 +11,227 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// ( )
// ( )
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class
SGravityModel
:
public
IGravityModel
class
SGravityModel
:
public
IGravityModel
{
{
public
:
public
:
//
//
SGravityModel
()
SGravityModel
()
{};
{}
//
//
SGravityModel
(
double
m
,
double
r
,
double
a
)
SGravityModel
(
double
m
,
double
r
,
double
a
)
{
mu
=
m
;
Re
=
r
;
alpha
=
a
;};
{
mu
=
m
;
Re
=
r
;
alpha
=
a
;
}
//
//
virtual
double
c
(
unsigned
int
/*n*/
,
unsigned
int
/*m*/
)
const
virtual
double
c
(
unsigned
int
/*n*/
,
unsigned
int
/*m*/
)
const
{
return
0
;};
{
virtual
double
d
(
unsigned
int
/*n*/
,
unsigned
int
/*m*/
)
const
return
0
;
{
return
0
;};
}
//
virtual
double
d
(
unsigned
int
/*n*/
,
unsigned
int
/*m*/
)
const
{
return
0
;
}
//
virtual
unsigned
int
N
()
const
virtual
unsigned
int
N
()
const
{
return
0
;};
{
return
0
;
}
virtual
unsigned
int
M
()
const
virtual
unsigned
int
M
()
const
{
return
0
;};
{
return
0
;
};
//
//
virtual
TGravityModelId
GetID
()
const
virtual
TGravityModelId
GetID
()
const
{
return
grIdMu
;};
{
};
return
grIdMu
;
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// PZ90
// PZ90
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class
EarthPZ90GravityModel
:
public
IGravityModel
class
EarthPZ90GravityModel
:
public
IGravityModel
{
{
public
:
public
:
//
//
EarthPZ90GravityModel
();
EarthPZ90GravityModel
();
//
//
virtual
double
c
(
unsigned
int
n
,
unsigned
int
m
)
const
virtual
double
c
(
unsigned
int
n
,
unsigned
int
m
)
const
{
return
CC
[
m
][
n
];};
{
virtual
double
d
(
unsigned
int
n
,
unsigned
int
m
)
const
return
CC
[
m
][
n
];
{
return
DD
[
m
][
n
];
};
};
virtual
double
d
(
unsigned
int
n
,
unsigned
int
m
)
const
{
return
DD
[
m
][
n
];
};
virtual
const
double
*
const
*
get_cc
()
const
{
return
CC
;
}
//
virtual
const
double
*
const
*
get_dd
()
const
{
return
DD
;
}
virtual
unsigned
int
N
()
const
{
return
36
;
};
virtual
unsigned
int
M
()
const
{
return
36
;
};
//
//
virtual
unsigned
int
N
()
const
{
return
36
;
};
virtual
unsigned
int
M
()
const
{
return
36
;
};
//
virtual
TGravityModelId
GetID
()
const
virtual
TGravityModelId
GetID
()
const
{
return
grIdPZ90
;};
{
return
grIdPZ90
;
};
protected
:
protected
:
//
//
double
**
CC
;
double
**
CC
;
double
**
DD
;
double
**
DD
;
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// ( )
// ( )
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class
EarthPZ902GravityModel
:
public
IGravityModel
class
EarthPZ902GravityModel
:
public
IGravityModel
{
{
public
:
public
:
//
//
EarthPZ902GravityModel
();
EarthPZ902GravityModel
();
//
double
**
getCC
()
const
{
virtual
double
c
(
unsigned
int
n
,
unsigned
int
m
)
const
return
CC
;
{
return
CC
[
m
][
n
];};
}
virtual
double
d
(
unsigned
int
n
,
unsigned
int
m
)
const
{
return
DD
[
m
][
n
];
};
double
**
getDD
()
const
{
return
DD
;
//
}
virtual
unsigned
int
N
()
const
{
return
36
;
};
//
virtual
unsigned
int
M
()
const
virtual
double
c
(
unsigned
int
n
,
unsigned
int
m
)
const
{
return
36
;
};
{
return
CC
[
m
][
n
];
//
};
virtual
TGravityModelId
GetID
()
const
virtual
double
d
(
unsigned
int
n
,
unsigned
int
m
)
const
{
return
grIdPZ902s
;};
{
return
DD
[
m
][
n
];
};
virtual
const
double
*
const
*
get_cc
()
const
{
return
CC
;
}
virtual
const
double
*
const
*
get_dd
()
const
{
return
DD
;
}
//
virtual
unsigned
int
N
()
const
{
return
36
;
};
virtual
unsigned
int
M
()
const
{
return
36
;
};
//
virtual
TGravityModelId
GetID
()
const
{
return
grIdPZ902s
;
};
protected
:
protected
:
//
//
double
**
CC
;
double
**
CC
;
double
**
DD
;
double
**
DD
;
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// ( )
// ( )
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class
GravityModel
:
public
IGravityModel
class
GravityModel
:
public
IGravityModel
{
{
public
:
public
:
// ,
// ,
//
//
GravityModel
(
TGravityModelId
Id
,
unsigned
int
N
,
unsigned
int
M
,
GravityModel
(
TGravityModelId
Id
,
unsigned
int
N
,
unsigned
int
M
,
const
IGravityModel
*
cd
);
const
IGravityModel
*
cd
);
//
//
GravityModel
();
GravityModel
();
//
//
virtual
~
GravityModel
()
virtual
~
GravityModel
()
{
freeAll
();};
{
freeAll
();
//
};
virtual
double
c
(
unsigned
int
n
,
unsigned
int
m
)
const
{
return
CC
[
m
][
n
];};
//
virtual
double
d
(
unsigned
int
n
,
unsigned
int
m
)
const
virtual
double
c
(
unsigned
int
n
,
unsigned
int
m
)
const
{
return
DD
[
m
][
n
];
};
{
return
CC
[
m
][
n
];
//
};
double
c
(
unsigned
int
n
,
unsigned
int
m
,
double
value
)
virtual
double
d
(
unsigned
int
n
,
unsigned
int
m
)
const
{
return
(
CC
[
m
][
n
]
=
value
);
};
{
double
d
(
unsigned
int
n
,
unsigned
int
m
,
double
value
)
return
DD
[
m
][
n
];
{
return
(
DD
[
m
][
n
]
=
value
);
};
};
//
//
virtual
unsigned
int
N
()
const
double
c
(
unsigned
int
n
,
unsigned
int
m
,
double
value
)
{
return
N_
;
};
{
virtual
unsigned
int
M
()
const
return
(
CC
[
m
][
n
]
=
value
);
{
return
M_
;
};
};
double
d
(
unsigned
int
n
,
unsigned
int
m
,
double
value
)
//
{
return
(
DD
[
m
][
n
]
=
value
);
};
virtual
const
double
*
const
*
get_cc
()
const
{
return
CC
;
}
virtual
const
double
*
const
*
get_dd
()
const
{
return
DD
;
}
//
virtual
unsigned
int
N
()
const
{
return
N_
;
};
virtual
unsigned
int
M
()
const
{
return
M_
;
};
//
virtual
TGravityModelId
GetID
()
const
virtual
TGravityModelId
GetID
()
const
{
return
Id
;};
{
return
Id
;
};
//
//
//
//
void
Init
(
unsigned
int
N
,
unsigned
int
M
,
const
IGravityModel
*
c_d
);
void
Init
(
unsigned
int
N
,
unsigned
int
M
,
const
IGravityModel
*
c_d
);
//
//
void
initEmpty
(
TGravityModelId
Id
);
void
initEmpty
(
TGravityModelId
Id
);
//
//
void
null
();
void
null
();
//
//
void
print
(
char
*
comment
,
FILE
*
out
=
stdout
)
const
;
void
print
(
char
*
comment
,
FILE
*
out
=
stdout
)
const
;
//
//
TGravityModelId
Id
;
TGravityModelId
Id
;
protected
:
protected
:
//
//
double
**
CC
;
double
**
CC
;
double
**
DD
;
double
**
DD
;
//
//
unsigned
int
N_
;
unsigned
int
N_
;
unsigned
int
M_
;
unsigned
int
M_
;
//
//
bool
isInit
;
bool
isInit
;
//
//
void
freeAll
();
void
freeAll
();
//
//
void
SetSize
(
unsigned
int
N
,
unsigned
int
M
);
void
SetSize
(
unsigned
int
N
,
unsigned
int
M
);
};
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#endif
#endif
bnolib/ephemeris.cpp
View file @
cbaaa495
...
@@ -151,103 +151,104 @@ bool Ephemeride::ReadData(const TimeJD &start, const TimeJD &end)
...
@@ -151,103 +151,104 @@ bool Ephemeride::ReadData(const TimeJD &start, const TimeJD &end)
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
Ephemeride
::
CalculatePolynom
(
double
t_cheb
,
double
*
coeff
,
double
*
coord
,
void
Ephemeride
::
CalculatePolynom
(
double
t_cheb
,
double
*
coeff
,
double
*
coord
,
double
*
coord_dt
,
double
*
coord_dt2
)
const
double
*
coord_dt
,
double
*
coord_dt2
)
const
{
{
double
b2
=
0.0
;
double
b2
=
0.0
;
double
b1
=
0.0
;
double
b1
=
0.0
;
double
b
;
double
b
;
double
b2_s
=
0.0
;
double
b2_s
=
0.0
;
double
b1_s
=
0.0
;
double
b1_s
=
0.0
;
double
b_s
=
0.0
;
double
b_s
=
0.0
;
double
b2_ss
=
0.0
;
double
b2_ss
=
0.0
;
double
b1_ss
=
0.0
;
double
b1_ss
=
0.0
;
double
b_ss
=
0.0
;
double
b_ss
=
0.0
;
for
(
int
i
=
Order
[
BodyID
];
i
>
0
;
--
i
)
for
(
int
i
=
Order
[
BodyID
];
i
>
0
;
--
i
)
{
{
b
=
coeff
[
i
]
-
b2
+
2.0
*
b1
*
t_cheb
;
b
=
coeff
[
i
]
-
b2
+
2.0
*
b1
*
t_cheb
;
b2
=
b1
;
b2
=
b1
;
b1
=
b
;
b1
=
b
;
if
(
coord_dt
||
coord_dt2
)
if
(
coord_dt
||
coord_dt2
)
{
{
b_s
=
2.0
*
(
b1_s
*
t_cheb
+
b2
)
-
b2_s
;
b_s
=
2.0
*
(
b1_s
*
t_cheb
+
b2
)
-
b2_s
;
b2_s
=
b1_s
;
b2_s
=
b1_s
;
b1_s
=
b_s
;
b1_s
=
b_s
;
}
}
if
(
coord_dt2
)
if
(
coord_dt2
)
{
{
b_ss
=
2.0
*
(
b1_ss
*
t_cheb
+
2.0
*
b2_s
)
-
b2_ss
;
b_ss
=
2.0
*
(
b1_ss
*
t_cheb
+
2.0
*
b2_s
)
-
b2_ss
;
b2_ss
=
b1_ss
;
b2_ss
=
b1_ss
;
b1_ss
=
b_ss
;
b1_ss
=
b_ss
;
}
}
}
}
if
(
coord
)
if
(
coord
)
*
coord
=
coeff
[
0
]
-
b2
+
b1
*
t_cheb
;
*
coord
=
coeff
[
0
]
-
b2
+
b1
*
t_cheb
;
if
(
coord_dt
)
if
(
coord_dt
)
*
coord_dt
=
b1
+
b_s
*
t_cheb
-
b2_s
;
*
coord_dt
=
b1
+
b_s
*
t_cheb
-
b2_s
;
if
(
coord_dt2
)
if
(
coord_dt2
)
*
coord_dt2
=
2.0
*
b1_s
+
b1_ss
*
t_cheb
-
b2_ss
;
*
coord_dt2
=
2.0
*
b1_s
+
b1_ss
*
t_cheb
-
b2_ss
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
Ephemeride
::
GetPosition
(
const
TimeJD
&
t
,
Vect3
*
pos
,
void
Ephemeride
::
GetPosition
(
const
TimeJD
&
t
,
Vect3
*
pos
,
Vect3
*
vel
,
Vect3
*
acc
)
const
Vect3
*
vel
,
Vect3
*
acc
)
const
{
{
TimeJD
tdb
(
t
);
// TAssert(XCoefs != NULL);
TAssert
(
XCoefs
!=
NULL
);
// TAssert(tdb >= StartTime && tdb <= EndTime);
TAssert
(
tdb
>=
StartTime
&&
tdb
<=
EndTime
);
if
(
GetFromCash
(
t
,
pos
,
vel
,
acc
))
if
(
GetFromCash
(
t
,
pos
,
vel
,
acc
))
return
;
return
;
TimeJD
tdb
(
t
);
double
diff
=
(
tdb
-
StartTime
).
GetDouble
();
double
tch
=
2.0
*
fmod
(
diff
/
DInterval
[
BodyID
],
1.0
)
-
1.0
;
double
diff
=
(
tdb
-
StartTime
).
GetDouble
();
int
offset
=
(
int
)
floor
(
diff
/
DInterval
[
BodyID
])
*
(
Order
[
BodyID
]
+
1
);
double
tch
=
2.0
*
fmod
(
diff
/
DInterval
[
BodyID
],
1.0
)
-
1.0
;
int
offset
=
(
int
)
floor
(
diff
/
DInterval
[
BodyID
])
*
(
Order
[
BodyID
]
+
1
);
CalculatePolynom
(
tch
,
XCoefs
+
offset
,
pos
==
NULL
?
NULL
:
&
pos
->
x
,
CalculatePolynom
(
tch
,
XCoefs
+
offset
,
vel
==
NULL
?
NULL
:
&
vel
->
x
,
pos
==
NULL
?
NULL
:
&
pos
->
x
,
acc
==
NULL
?
NULL
:
&
acc
->
x
);
vel
==
NULL
?
NULL
:
&
vel
->
x
,
acc
==
NULL
?
NULL
:
&
acc
->
x
);
CalculatePolynom
(
tch
,
YCoefs
+
offset
,
pos
==
NULL
?
NULL
:
&
pos
->
y
,
CalculatePolynom
(
tch
,
YCoefs
+
offset
,
vel
==
NULL
?
NULL
:
&
vel
->
y
,
pos
==
NULL
?
NULL
:
&
pos
->
y
,
acc
==
NULL
?
NULL
:
&
acc
->
y
);
vel
==
NULL
?
NULL
:
&
vel
->
y
,
acc
==
NULL
?
NULL
:
&
acc
->
y
);
CalculatePolynom
(
tch
,
ZCoefs
+
offset
,
pos
==
NULL
?
NULL
:
&
pos
->
z
,
CalculatePolynom
(
tch
,
ZCoefs
+
offset
,
vel
==
NULL
?
NULL
:
&
vel
->
z
,
pos
==
NULL
?
NULL
:
&
pos
->
z
,
acc
==
NULL
?
NULL
:
&
acc
->
z
);
vel
==
NULL
?
NULL
:
&
vel
->
z
,
acc
==
NULL
?
NULL
:
&
acc
->
z
);
double
dt_scale
=
2
/
(
86400.0
*
DInterval
[
BodyID
]);
double
dt2_scale
=
dt_scale
*
dt_scale
*
1.e3
;
double
dt_scale
=
2
/
(
86400.0
*
DInterval
[
BodyID
]);
if
(
pos
)
double
dt2_scale
=
dt_scale
*
dt_scale
*
1.e3
;
if
(
pos
)
{
{
pos
->
x
*=
1.e-3
;
pos
->
x
*=
1.e-3
;
pos
->
y
*=
1.e-3
;
pos
->
y
*=
1.e-3
;
pos
->
z
*=
1.e-3
;
pos
->
z
*=
1.e-3
;
}
}
if
(
vel
)
if
(
vel
)
{
{
vel
->
x
*=
dt_scale
;
vel
->
x
*=
dt_scale
;
vel
->
y
*=
dt_scale
;
vel
->
y
*=
dt_scale
;
vel
->
z
*=
dt_scale
;
vel
->
z
*=
dt_scale
;
}
}
if
(
acc
)
if
(
acc
)
{
{
acc
->
x
*=
dt2_scale
;
acc
->
x
*=
dt2_scale
;
acc
->
y
*=
dt2_scale
;
acc
->
y
*=
dt2_scale
;
acc
->
z
*=
dt2_scale
;
acc
->
z
*=
dt2_scale
;
}
}
PutToCash
(
t
,
pos
,
vel
,
acc
);
PutToCash
(
t
,
pos
,
vel
,
acc
);
return
;
return
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//
bool
Ephemeride
::
GetFromCash
(
const
TimeJD
&
t
,
Vect3
*
pos
,
Vect3
*
vel
,
Vect3
*
acc
)
const
bool
Ephemeride
::
GetFromCash
(
const
TimeJD
&
t
,
Vect3
*
pos
,
Vect3
*
vel
,
Vect3
*
acc
)
const
...
...
utils/TextFunctions.h
View file @
cbaaa495
...
@@ -185,7 +185,7 @@ static bool ReadFile(std::string path, std::string &str)
...
@@ -185,7 +185,7 @@ static bool ReadFile(std::string path, std::string &str)
size_t
res
=
fread
(
buf
,
len
,
1
,
fp
);
//read into buffer
size_t
res
=
fread
(
buf
,
len
,
1
,
fp
);
//read into buffer
fclose
(
fp
);
fclose
(
fp
);
str
=
std
::
string
(
buf
);
str
=
std
::
string
(
buf
);
delete
buf
;
delete
[]
buf
;
if
(
!
res
){
if
(
!
res
){
return
false
;
return
false
;
...
...
utils/interpolate.cpp
View file @
cbaaa495
...
@@ -104,10 +104,6 @@ void XInterpolator::calc_positions(const SInitOrbit& orbit, const TimeJD& beg, c
...
@@ -104,10 +104,6 @@ void XInterpolator::calc_positions(const SInitOrbit& orbit, const TimeJD& beg, c
TimeJD
beg_ext
=
ShiftDate
(
beg
,
-
n
*
step
);
TimeJD
beg_ext
=
ShiftDate
(
beg
,
-
n
*
step
);
TimeJD
end_ext
=
ShiftDate
(
end
,
+
n
*
step
);
TimeJD
end_ext
=
ShiftDate
(
end
,
+
n
*
step
);
// std::string s_beg = DateToStr(beg);
// std::string s_date = DateToStr(orbDate);
// std::string s_end = DateToStr(end);
if
(
orbit
.
GetDate
()
<=
beg_ext
){
if
(
orbit
.
GetDate
()
<=
beg_ext
){
propagate
(
orbit
,
beg_ext
,
end_ext
,
1
,
result
);
propagate
(
orbit
,
beg_ext
,
end_ext
,
1
,
result
);
}
else
if
(
orbit
.
GetDate
()
>=
end_ext
){
}
else
if
(
orbit
.
GetDate
()
>=
end_ext
){
...
...
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