File Coverage

erfasrc/src/ltpecl.c
Criterion Covered Total %
statement 0 21 0.0
branch 0 6 0.0
condition n/a
subroutine n/a
pod n/a
total 0 27 0.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 0           void eraLtpecl(double epj, double vec[3])
4             /*
5             ** - - - - - - - - - -
6             ** e r a L t p e c l
7             ** - - - - - - - - - -
8             **
9             ** Long-term precession of the ecliptic.
10             **
11             ** Given:
12             ** epj double Julian epoch (TT)
13             **
14             ** Returned:
15             ** vec double[3] ecliptic pole unit vector
16             **
17             ** Notes:
18             **
19             ** 1) The returned vector is with respect to the J2000.0 mean equator
20             ** and equinox.
21             **
22             ** 2) The Vondrak et al. (2011, 2012) 400 millennia precession model
23             ** agrees with the IAU 2006 precession at J2000.0 and stays within
24             ** 100 microarcseconds during the 20th and 21st centuries. It is
25             ** accurate to a few arcseconds throughout the historical period,
26             ** worsening to a few tenths of a degree at the end of the
27             ** +/- 200,000 year time span.
28             **
29             ** References:
30             **
31             ** Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
32             ** expressions, valid for long time intervals, Astron.Astrophys. 534,
33             ** A22
34             **
35             ** Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
36             ** expressions, valid for long time intervals (Corrigendum),
37             ** Astron.Astrophys. 541, C1
38             **
39             ** Copyright (C) 2013-2019, NumFOCUS Foundation.
40             ** Derived, with permission, from the SOFA library. See notes at end of file.
41             */
42             {
43             /* Obliquity at J2000.0 (radians). */
44             static const double eps0 = 84381.406 * ERFA_DAS2R;
45              
46             /* Polynomial coefficients */
47             enum { NPOL = 4 };
48             static const double pqpol[2][NPOL] = {
49             { 5851.607687,
50             -0.1189000,
51             -0.00028913,
52             0.000000101},
53             {-1600.886300,
54             1.1689818,
55             -0.00000020,
56             -0.000000437}
57             };
58              
59             /* Periodic coefficients */
60             static const double pqper[][5] = {
61             { 708.15,-5486.751211,-684.661560, 667.666730,-5523.863691},
62             {2309.00, -17.127623,2446.283880,-2354.886252, -549.747450},
63             {1620.00, -617.517403, 399.671049, -428.152441, -310.998056},
64             { 492.20, 413.442940,-356.652376, 376.202861, 421.535876},
65             {1183.00, 78.614193,-186.387003, 184.778874, -36.776172},
66             { 622.00, -180.732815,-316.800070, 335.321713, -145.278396},
67             { 882.00, -87.676083, 198.296701, -185.138669, -34.744450},
68             { 547.00, 46.140315, 101.135679, -120.972830, 22.885731}
69             };
70             static const int NPER = (int) ( sizeof pqper / 5 / sizeof (double) );
71              
72             /* Miscellaneous */
73             int i;
74             double t, p, q, w, a, s, c;
75              
76              
77             /* Centuries since J2000. */
78 0           t = ( epj - 2000.0 ) / 100.0;
79              
80             /* Initialize P_A and Q_A accumulators. */
81             p = 0.0;
82             q = 0.0;
83              
84             /* Periodic terms. */
85 0           w = ERFA_D2PI*t;
86 0 0         for ( i = 0; i < NPER; i++ ) {
87 0           a = w/pqper[i][0];
88 0           s = sin(a);
89 0           c = cos(a);
90 0           p += c*pqper[i][1] + s*pqper[i][3];
91 0           q += c*pqper[i][2] + s*pqper[i][4];
92             }
93              
94             /* Polynomial terms. */
95             w = 1.0;
96 0 0         for ( i = 0; i < NPOL; i++ ) {
97 0           p += pqpol[0][i]*w;
98 0           q += pqpol[1][i]*w;
99 0           w *= t;
100             }
101              
102             /* P_A and Q_A (radians). */
103 0           p *= ERFA_DAS2R;
104 0           q *= ERFA_DAS2R;
105              
106             /* Form the ecliptic pole vector. */
107 0           w = 1.0 - p*p - q*q;
108 0 0         w = w < 0.0 ? 0.0 : sqrt(w);
109             s = sin(eps0);
110             c = cos(eps0);
111 0           vec[0] = p;
112 0           vec[1] = - q*c - w*s;
113 0           vec[2] = - q*s + w*c;
114              
115 0           }
116             /*----------------------------------------------------------------------
117             **
118             **
119             ** Copyright (C) 2013-2019, NumFOCUS Foundation.
120             ** All rights reserved.
121             **
122             ** This library is derived, with permission, from the International
123             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
124             ** available from http://www.iausofa.org.
125             **
126             ** The ERFA version is intended to retain identical functionality to
127             ** the SOFA library, but made distinct through different function and
128             ** file names, as set out in the SOFA license conditions. The SOFA
129             ** original has a role as a reference standard for the IAU and IERS,
130             ** and consequently redistribution is permitted only in its unaltered
131             ** state. The ERFA version is not subject to this restriction and
132             ** therefore can be included in distributions which do not support the
133             ** concept of "read only" software.
134             **
135             ** Although the intent is to replicate the SOFA API (other than
136             ** replacement of prefix names) and results (with the exception of
137             ** bugs; any that are discovered will be fixed), SOFA is not
138             ** responsible for any errors found in this version of the library.
139             **
140             ** If you wish to acknowledge the SOFA heritage, please acknowledge
141             ** that you are using a library derived from SOFA, rather than SOFA
142             ** itself.
143             **
144             **
145             ** TERMS AND CONDITIONS
146             **
147             ** Redistribution and use in source and binary forms, with or without
148             ** modification, are permitted provided that the following conditions
149             ** are met:
150             **
151             ** 1 Redistributions of source code must retain the above copyright
152             ** notice, this list of conditions and the following disclaimer.
153             **
154             ** 2 Redistributions in binary form must reproduce the above copyright
155             ** notice, this list of conditions and the following disclaimer in
156             ** the documentation and/or other materials provided with the
157             ** distribution.
158             **
159             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
160             ** the International Astronomical Union nor the names of its
161             ** contributors may be used to endorse or promote products derived
162             ** from this software without specific prior written permission.
163             **
164             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
165             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
166             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
167             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
168             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
169             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
170             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
171             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
172             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
173             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
174             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
175             ** POSSIBILITY OF SUCH DAMAGE.
176             **
177             */