1 #ifndef SOFAMHDEF
2 #define SOFAMHDEF
3 
4 /*
5 **  - - - - - - - -
6 **   s o f a m . h
7 **  - - - - - - - -
8 **
9 **  Macros used by SOFA library.
10 **
11 **  This file is part of the International Astronomical Union's
12 **  SOFA (Standards Of Fundamental Astronomy) software collection.
13 **
14 **  Please note that the constants defined below are to be used only in
15 **  the context of the SOFA software, and have no other official IAU
16 **  status.  In addition, self consistency is not guaranteed.
17 **
18 **  This revision:   2021 February 24
19 **
20 **  SOFA release 2021-05-12
21 **
22 **  Copyright (C) 2021 IAU SOFA Board.  See notes at end.
23 */
24 
25 /* Pi */
26 #define DPI (3.141592653589793238462643)
27 
28 /* 2Pi */
29 #define D2PI (6.283185307179586476925287)
30 
31 /* Radians to degrees */
32 #define DR2D (57.29577951308232087679815)
33 
34 /* Degrees to radians */
35 #define DD2R (1.745329251994329576923691e-2)
36 
37 /* Radians to arcseconds */
38 #define DR2AS (206264.8062470963551564734)
39 
40 /* Arcseconds to radians */
41 #define DAS2R (4.848136811095359935899141e-6)
42 
43 /* Seconds of time to radians */
44 #define DS2R (7.272205216643039903848712e-5)
45 
46 /* Arcseconds in a full circle */
47 #define TURNAS (1296000.0)
48 
49 /* Milliarcseconds to radians */
50 #define DMAS2R (DAS2R / 1e3)
51 
52 /* Length of tropical year B1900 (days) */
53 #define DTY (365.242198781)
54 
55 /* Seconds per day. */
56 #define DAYSEC (86400.0)
57 
58 /* Days per Julian year */
59 #define DJY (365.25)
60 
61 /* Days per Julian century */
62 #define DJC (36525.0)
63 
64 /* Days per Julian millennium */
65 #define DJM (365250.0)
66 
67 /* Reference epoch (J2000.0), Julian Date */
68 #define DJ00 (2451545.0)
69 
70 /* Julian Date of Modified Julian Date zero */
71 #define DJM0 (2400000.5)
72 
73 /* Reference epoch (J2000.0), Modified Julian Date */
74 #define DJM00 (51544.5)
75 
76 /* 1977 Jan 1.0 as MJD */
77 #define DJM77 (43144.0)
78 
79 /* TT minus TAI (s) */
80 #define TTMTAI (32.184)
81 
82 /* Astronomical unit (m, IAU 2012) */
83 #define DAU (149597870.7e3)
84 
85 /* Speed of light (m/s) */
86 #define CMPS 299792458.0
87 
88 /* Light time for 1 au (s) */
89 #define AULT (DAU/CMPS)
90 
91 /* Speed of light (au per day) */
92 #define DC (DAYSEC/AULT)
93 
94 /* L_G = 1 - d(TT)/d(TCG) */
95 #define ELG (6.969290134e-10)
96 
97 /* L_B = 1 - d(TDB)/d(TCB), and TDB (s) at TAI 1977/1/1.0 */
98 #define ELB (1.550519768e-8)
99 #define TDB0 (-6.55e-5)
100 
101 /* Schwarzschild radius of the Sun (au) */
102 /* = 2 * 1.32712440041e20 / (2.99792458e8)^2 / 1.49597870700e11 */
103 #define SRS 1.97412574336e-8
104 
105 /* dint(A) - truncate to nearest whole number towards zero (double) */
106 #define dint(A) ((A)<0.0?ceil(A):floor(A))
107 
108 /* dnint(A) - round to nearest whole number (double) */
109 #define dnint(A) (fabs(A)<0.5?0.0\
110                                 :((A)<0.0?ceil((A)-0.5):floor((A)+0.5)))
111 
112 /* dsign(A,B) - magnitude of A with sign of B (double) */
113 #define dsign(A,B) ((B)<0.0?-fabs(A):fabs(A))
114 
115 /* max(A,B) - larger (most +ve) of two numbers (generic) */
116 #define gmax(A,B) (((A)>(B))?(A):(B))
117 
118 /* min(A,B) - smaller (least +ve) of two numbers (generic) */
119 #define gmin(A,B) (((A)<(B))?(A):(B))
120 
121 /* Reference ellipsoids */
122 #define WGS84 1
123 #define GRS80 2
124 #define WGS72 3
125 
126 #endif
127 
128 /*----------------------------------------------------------------------
129 **
130 **  Copyright (C) 2021
131 **  Standards Of Fundamental Astronomy Board
132 **  of the International Astronomical Union.
133 **
134 **  =====================
135 **  SOFA Software License
136 **  =====================
137 **
138 **  NOTICE TO USER:
139 **
140 **  BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
141 **  CONDITIONS WHICH APPLY TO ITS USE.
142 **
143 **  1. The Software is owned by the IAU SOFA Board ("SOFA").
144 **
145 **  2. Permission is granted to anyone to use the SOFA software for any
146 **     purpose, including commercial applications, free of charge and
147 **     without payment of royalties, subject to the conditions and
148 **     restrictions listed below.
149 **
150 **  3. You (the user) may copy and distribute SOFA source code to others,
151 **     and use and adapt its code and algorithms in your own software,
152 **     on a world-wide, royalty-free basis.  That portion of your
153 **     distribution that does not consist of intact and unchanged copies
154 **     of SOFA source code files is a "derived work" that must comply
155 **     with the following requirements:
156 **
157 **     a) Your work shall be marked or carry a statement that it
158 **        (i) uses routines and computations derived by you from
159 **        software provided by SOFA under license to you; and
160 **        (ii) does not itself constitute software provided by and/or
161 **        endorsed by SOFA.
162 **
163 **     b) The source code of your derived work must contain descriptions
164 **        of how the derived work is based upon, contains and/or differs
165 **        from the original SOFA software.
166 **
167 **     c) The names of all routines in your derived work shall not
168 **        include the prefix "iau" or "sofa" or trivial modifications
169 **        thereof such as changes of case.
170 **
171 **     d) The origin of the SOFA components of your derived work must
172 **        not be misrepresented;  you must not claim that you wrote the
173 **        original software, nor file a patent application for SOFA
174 **        software or algorithms embedded in the SOFA software.
175 **
176 **     e) These requirements must be reproduced intact in any source
177 **        distribution and shall apply to anyone to whom you have
178 **        granted a further right to modify the source code of your
179 **        derived work.
180 **
181 **     Note that, as originally distributed, the SOFA software is
182 **     intended to be a definitive implementation of the IAU standards,
183 **     and consequently third-party modifications are discouraged.  All
184 **     variations, no matter how minor, must be explicitly marked as
185 **     such, as explained above.
186 **
187 **  4. You shall not cause the SOFA software to be brought into
188 **     disrepute, either by misuse, or use for inappropriate tasks, or
189 **     by inappropriate modification.
190 **
191 **  5. The SOFA software is provided "as is" and SOFA makes no warranty
192 **     as to its use or performance.   SOFA does not and cannot warrant
193 **     the performance or results which the user may obtain by using the
194 **     SOFA software.  SOFA makes no warranties, express or implied, as
195 **     to non-infringement of third party rights, merchantability, or
196 **     fitness for any particular purpose.  In no event will SOFA be
197 **     liable to the user for any consequential, incidental, or special
198 **     damages, including any lost profits or lost savings, even if a
199 **     SOFA representative has been advised of such damages, or for any
200 **     claim by any third party.
201 **
202 **  6. The provision of any version of the SOFA software under the terms
203 **     and conditions specified herein does not imply that future
204 **     versions will also be made available under the same terms and
205 **     conditions.
206 *
207 **  In any published work or commercial product which uses the SOFA
208 **  software directly, acknowledgement (see www.iausofa.org) is
209 **  appreciated.
210 **
211 **  Correspondence concerning SOFA software should be addressed as
212 **  follows:
213 **
214 **      By email:  sofa@ukho.gov.uk
215 **      By post:   IAU SOFA Center
216 **                 HM Nautical Almanac Office
217 **                 UK Hydrographic Office
218 **                 Admiralty Way, Taunton
219 **                 Somerset, TA1 2DN
220 **                 United Kingdom
221 **
222 **--------------------------------------------------------------------*/
223