casacore
Loading...
Searching...
No Matches
Nutation.h
Go to the documentation of this file.
1//# Nutation.h: Nutation class
2//# Copyright (C) 1995,1996,1997,1998,2003,2004
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: casa-feedback@nrao.edu.
21//# Postal address: AIPS++ Project Office
22//# National Radio Astronomy Observatory
23//# 520 Edgemont Road
24//# Charlottesville, VA 22903-2475 USA
25
26#ifndef MEASURES_NUTATION_H
27#define MEASURES_NUTATION_H
28
29//# Includes
30#include <mutex>
31
32#include <casacore/casa/aips.h>
33#include <casacore/casa/Quanta/Quantum.h>
34#include <casacore/casa/Quanta/Euler.h>
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38//# Forward Declarations
39
40// <summary> Nutation class and calculations </summary>
41
42// <use visibility=export>
43
44// <reviewed reviewer="Tim Cornwell" date="1996/07/01" tests="tMeasMath"
45// demos="">
46// </reviewed>
47
48// <prerequisite>
49// <li> <linkto class=Measure>Measure</linkto> class
50// <li> <linkto class=Euler>Euler</linkto>
51// <li> <linkto class=MeasData>MeasData</linkto> class for constants
52// </prerequisite>
53//
54// <etymology>
55// Nutation
56// </etymology>
57//
58// <synopsis>
59// Nutation forms the class for Nutation calculations. It is a simple
60// container with the selected method, and the mean epoch.
61// It acts as a cache
62// for values and their derivatives, to enable fast calculations for time
63// epochs close together (see the <em>aipsrc</em> variable
64// <em>measures.nutation.d_interval</em>).
65//
66// The calculation method is selected from one of the following:
67// <ul>
68// <li> Nutation::STANDARD (at 1995/09/04 the IAU1980 definition,
69// from 2004/01/01 IAU2000B)
70// <li> Nutation::NONE (nutation of zero returned)
71// <li> Nutation::IAU1980
72// <li> Nutation::B1950
73// <li> Nutation::IAU2000
74// <li> Nutation::IAU2000A (equal to the full precision (uas) IAU2000)
75// <li> Nutation::IAU2000B (official lower precision (mas) of IAU2000)
76// </ul>
77// Epochs can be specified as the MJD (with defined constants MeasData::MJD2000
78// and MeasData::MJDB1950 or the actual MJD),
79// leading to the following constructors:
80// <ul>
81// <li> Nutation() default; assuming STANDARD
82// <li> Nutation(method)
83// </ul>
84// Actual Nutation for a certain Epoch is calculated by the () operator
85// as Nutation(epoch), with epoch Double MJD. Values are returned as an
86// <linkto class=Euler>Euler</linkto>.
87// The derivative (d<sup>-1</sup>) can be obtained as well by
88// derivative(epoch). <br>
89// A Nutation can be re-initialed with a different method and/or zero
90// epoch with the <src>init()</src> functions (same format as constructors).
91// To bypass the full calculation actual returned values are calculated
92// using the derivative if within about 2 hours (error less than about
93// 10<sup>-5</sup> mas). A call to refresh() will re-initiate calculations
94// from scratch.<br>
95// The following details can be set with the
96// <linkto class=Aipsrc>Aipsrc</linkto> mechanism:
97// <ul>
98// <li> measures.nutation.d_interval: approximation interval as time
99// (fraction of days is default unit) over which linear approximation
100// is used (default 0.04d (about 1 hour)).
101// <li> measures.nutation.b_usejpl: use the JPL database nutations for
102// IAU1980.
103// Else analytical expression, relative error about 10<sup>-9</sup>
104// Note that the JPL database to be used can be set with
105// measures.jpl.ephemeris (at the moment of writing DE200
106// (default), or DE405)
107// <li> measures.nutation.b_useiers: use the IERS Database nutation
108// corrections for IAU1980 (default False)
109// </ul>
110// </synopsis>
111//
112// <example>
113// <srcblock>
114// #include <casacore/measures/Measures.h>
115// MVDirection pos(Quantity(10,"degree"),Quantity(-10.5,"degree"));
116// // direction RA=10; DEC=-10.5
117// Nutation mine(Nutation::IAU1980); // define nutation type
118// RotMatrix rotat(mine(45837.0)); // rotation matrix for 84/05/17
119// MVDirection new = rotat*pos; // apply nutation
120// </srcblock>
121// The normal way to use Nutation is by using the
122// <linkto class=MeasConvert>MeasConvert</linkto> class.
123// </example>
124//
125// <motivation>
126// To calculate the Nutation angles. An alternate route could have been
127// a global function, but having a simple container allows caching of some
128// calculations for speed.<br>
129// Using MJD (JD-2400000.5) rather than JD is for precision reasons.
130// </motivation>
131//
132// <todo asof="2003/10/20">
133// <li> Correct deval_p (derivative complimentary eqox terms)
134// <li> Improve speed by a bit more lazyness in derivative calculations
135// and separate eqox calculations
136// </todo>
137
138class Nutation {
139 public:
140 //# Constants
141 // Interval to be used for linear approximation (in days)
142 static const Double INTV;
143
144 //# Enumerations
145 // Types of known Nutation calculations (at 1995/09/04 STANDARD == IAU1980,
146 // after 2004/01/01 it will be IAU2000B))
151
152 //# Constructors
153 // Default constructor, generates default J2000 Nutation identification
155 // Copy constructor
156 Nutation(const Nutation &other);
157 // Constructor with type
159 // Copy assignment
161
162 //# Destructor
164
165 //# Operators
166 // Return the Nutation angles
167 const Euler &operator()(Double epoch);
168
169 //# General Member Functions
170 // Return derivative of Nutation (d<sup>-1</sup>)
171 const Euler &derivative(Double epoch);
172
173 // Re-initialise Nutation object
174 // <group>
175 void init();
177 // </group>
178
179 // Refresh calculations
180 void refresh();
181
182 // Get the equation of equinox
183 // <group>
186 Quantity getEqoxAngle(Double epoch, const Unit &unit) ;
187 // </group>
188 // Get the derivative of the equation of equinoxes in d<sup>-1</sup>
190 // Get the complimentary terms of the equation of equinoxes
192 // Get the derivative of the complimentary terms of the equation of equinoxes
194
195 private:
196
197 //# Data members
198 // Method to be used
200 // Check epoch for linear approximation
202 // Check epoch for calculation of derivatives
204 // Cached calculated angles
206 // Cached derivatives
208 // Cached equation of equinoxes
210 // Cached derivative equation of equinoxes
212 // Cached complimentary terms equation of equinoxes
214 // Cached derivative of complimentary terms equation of equinoxes
216 // To be able to use references rather than copies, and also to use these
217 // references in simple (up to 4 terms of Nutation results) expressions,
218 // results are calculated in circulating buffer
220 // Last calculation
222 // Interpolation interval
224 // IERS use
226 // JPL use
228 static inline std::once_flag once_flag_;
229
230 //# Member functions
231 // Make a copy
232 void copy(const Nutation &other);
233 // Fill an empty copy
234 void fill();
235
236 static void load_static_values();
237
238 // Calculate Nutation angles for time t; also derivatives if True given
239 void calcNut(Double t, Bool calcDer = False);
240};
241
242
243} //# NAMESPACE CASACORE - END
244
245#endif
246
247
static std::once_flag once_flag_
Definition Nutation.h:228
static uInt myInterval_reg
Interpolation interval.
Definition Nutation.h:223
void init(NutationTypes type)
void calcNut(Double t, Bool calcDer=False)
Calculate Nutation angles for time t; also derivatives if True given.
Quantity getEqoxAngle(Double epoch)
static void load_static_values()
Double neval_p
Cached complimentary terms equation of equinoxes.
Definition Nutation.h:213
Nutation()
Default constructor, generates default J2000 Nutation identification.
NutationTypes
Types of known Nutation calculations (at 1995/09/04 STANDARD == IAU1980, after 2004/01/01 it will be ...
Definition Nutation.h:147
Double nval_p[3]
Cached calculated angles.
Definition Nutation.h:205
void refresh()
Refresh calculations.
Double eqoxCT(Double epoch)
Get the complimentary terms of the equation of equinoxes.
Double derivativeEqox(Double epoch)
Get the derivative of the equation of equinoxes in d-1.
NutationTypes method_p
Method to be used.
Definition Nutation.h:199
Euler result_p[4]
Last calculation.
Definition Nutation.h:221
Double eqox(Double epoch)
Get the equation of equinox.
Nutation(NutationTypes type)
Constructor with type.
Quantity getEqoxAngle(Double epoch, const Unit &unit)
Nutation & operator=(const Nutation &other)
Copy assignment.
void fill()
Fill an empty copy.
static const Double INTV
Interval to be used for linear approximation (in days).
Definition Nutation.h:142
Double deval_p
Cached derivative of complimentary terms equation of equinoxes.
Definition Nutation.h:215
Double checkDerEpoch_p
Check epoch for calculation of derivatives.
Definition Nutation.h:203
Double checkEpoch_p
Check epoch for linear approximation.
Definition Nutation.h:201
void init()
Re-initialise Nutation object.
Nutation(const Nutation &other)
Copy constructor.
const Euler & derivative(Double epoch)
Return derivative of Nutation (d-1).
static uInt myUseiers_reg
IERS use.
Definition Nutation.h:225
Int lres_p
To be able to use references rather than copies, and also to use these references in simple (up to 4 ...
Definition Nutation.h:219
static uInt myUsejpl_reg
JPL use.
Definition Nutation.h:227
Double eqeq_p
Cached equation of equinoxes.
Definition Nutation.h:209
const Euler & operator()(Double epoch)
Return the Nutation angles.
Double dval_p[3]
Cached derivatives.
Definition Nutation.h:207
Double derivativeEqoxCT(Double epoch)
Get the derivative of the complimentary terms of the equation of equinoxes.
void copy(const Nutation &other)
Make a copy.
Double deqeq_p
Cached derivative equation of equinoxes.
Definition Nutation.h:211
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Quantum< Double > Quantity
Definition Quantum.h:39
double Double
Definition aipstype.h:53