General Purpose Geodetic Library
SgMathSupport.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef SG_MATH_DEFINITIONS_H
24 #define SG_MATH_DEFINITIONS_H
25 
26 
27 #include <math.h>
28 #include <complex>
29 
30 #include <QtCore/QString>
31 
32 
33 class SgMJD;
34 class Sg3dVector;
35 class Sg3dMatrix;
36 
37 
38 
40 #ifndef RAD2DEG
41 #define RAD2DEG (180.0/M_PI)
42 #endif
44 #ifndef RAD2HR
45 #define RAD2HR (12.0 /M_PI)
46 #endif
48 #ifndef DEG2RAD
49 #define DEG2RAD (M_PI/180.0)
50 #endif
52 #ifndef DEG2SEC
53 #define DEG2SEC (3600.0)
54 #endif
56 #ifndef HR2RAD
57 #define HR2RAD (M_PI/ 12.0)
58 #endif
60 #ifndef SEC2RAD
61 #define SEC2RAD (DEG2RAD/3600.0)
62 #endif
64 #ifndef RAD2SEC
65 #define RAD2SEC (RAD2DEG*3600.0)
66 #endif
68 #ifndef DAY2SEC
69 #define DAY2SEC (86400.0)
70 #endif
72 #ifndef RAD2MAS
73 #define RAD2MAS (RAD2SEC*1000.0)
74 #endif
76 #ifndef RAD2MS
77 #define RAD2MS (RAD2HR*3600.0*1000.0)
78 #endif
79 
80 
81 enum DIRECTION {X_AXIS=0, VERTICAL=0, Y_AXIS=1, EAST=1, Z_AXIS=2, NORTH=2};
83 
84 
85 //
86 // functions:
87 //
88 
89 inline double signum(const double x) {return x<0.0 ? -1.0 : 1.0;};
90 inline double cpsign(const double a1, const double a2) {return fabs(a1)*signum(a2);};// copysign(a1, a2)?
91 inline void swap(double &a1, double &a2) {double tmp=a1; a1=a2; a2=tmp;};
92 
93 // FFT support:
94 unsigned int reverseBitOrder(unsigned int n, unsigned int k);
95 void fft(std::complex<double> x_a[], std::complex<double> x_A[], unsigned int n, FFT_Direction dir);
96 
97 // some geodetic stuff (replacements of IERS procedures)
98 //
99 void geocentric2geodetic(const Sg3dVector& r, double& latitude, double& longitude, double& height,
100  bool useOldEllipsoid);
101 //
102 //
103 void calcCip2IAU1980(const SgMJD& epoch, double dX, double dY, double dPsi_1980, double dEps_1980,
104  double dPsi_2000, double dEps_2000, double& diffPsi, double& diffEps);
105 //
106 void calcNutationFundArgs_IersConv2003(const SgMJD& tEpoch, double args[5]);
107 //
108 void calcNutationFundArgs_IersConv1996(const SgMJD& tEpoch, double args[5]);
109 //
110 void calcNutationFundArgs_IersStds1992(const SgMJD& tEpoch, double args[5]);
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 //
121 // constants:
122 //
123 // these constants are defined in GPGeoMath3dVector.cpp:
124 extern const Sg3dVector v3Zero;
125 extern const Sg3dVector v3Unit;
126 
127 // these constants are defined in GPGeoMath3dMatrix.cpp:
128 extern const Sg3dMatrix m3E;
129 extern const Sg3dMatrix m3Zero;
130 
131 // Imaginary unit:
132 extern const std::complex<double>
133  zI;
134 
135 
136 
137 
138 
139 
140 
141 #endif //SG_MATH_DEFINITIONS_H
void geocentric2geodetic(const Sg3dVector &r, double &latitude, double &longitude, double &height, bool useOldEllipsoid)
const Sg3dMatrix m3E
void swap(double &a1, double &a2)
Definition: SgMathSupport.h:91
const Sg3dMatrix m3Zero
double signum(const double x)
Definition: SgMathSupport.h:89
void calcNutationFundArgs_IersConv1996(const SgMJD &tEpoch, double args[5])
const Sg3dVector v3Unit
const Sg3dVector v3Zero
void fft(std::complex< double > x_a[], std::complex< double > x_A[], unsigned int n, FFT_Direction dir)
void calcNutationFundArgs_IersConv2003(const SgMJD &tEpoch, double args[5])
DIRECTION
Definition: SgMathSupport.h:81
@ VERTICAL
Definition: SgMathSupport.h:81
@ Z_AXIS
Definition: SgMathSupport.h:81
@ X_AXIS
Definition: SgMathSupport.h:81
@ Y_AXIS
Definition: SgMathSupport.h:81
@ EAST
Definition: SgMathSupport.h:81
@ NORTH
Definition: SgMathSupport.h:81
unsigned int reverseBitOrder(unsigned int n, unsigned int k)
void calcCip2IAU1980(const SgMJD &epoch, double dX, double dY, double dPsi_1980, double dEps_1980, double dPsi_2000, double dEps_2000, double &diffPsi, double &diffEps)
FFT_Direction
Definition: SgMathSupport.h:82
@ FFT_Inverse
Definition: SgMathSupport.h:82
@ FFT_Forward
Definition: SgMathSupport.h:82
double cpsign(const double a1, const double a2)
Definition: SgMathSupport.h:90
const std::complex< double > zI
void calcNutationFundArgs_IersStds1992(const SgMJD &tEpoch, double args[5])
Definition: SgMJD.h:59