casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: aips2-request@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 //#
27 //# $Id$
28 
29 #ifndef MEASURES_NUTATION_H
30 #define MEASURES_NUTATION_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 
41 // <summary> Nutation class and calculations </summary>
42 
43 // <use visibility=export>
44 
45 // <reviewed reviewer="Tim Cornwell" date="1996/07/01" tests="tMeasMath"
46 // demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> <linkto class=Measure>Measure</linkto> class
51 // <li> <linkto class=Euler>Euler</linkto>
52 // <li> <linkto class=MeasData>MeasData</linkto> class for constants
53 // </prerequisite>
54 //
55 // <etymology>
56 // Nutation
57 // </etymology>
58 //
59 // <synopsis>
60 // Nutation forms the class for Nutation calculations. It is a simple
61 // container with the selected method, and the mean epoch.
62 // It acts as a cache
63 // for values and their derivatives, to enable fast calculations for time
64 // epochs close together (see the <em>aipsrc</em> variable
65 // <em>measures.nutation.d_interval</em>).
66 //
67 // The calculation method is selected from one of the following:
68 // <ul>
69 // <li> Nutation::STANDARD (at 1995/09/04 the IAU1980 definition,
70 // from 2004/01/01 IAU2000B)
71 // <li> Nutation::NONE (nutation of zero returned)
72 // <li> Nutation::IAU1980
73 // <li> Nutation::B1950
74 // <li> Nutation::IAU2000
75 // <li> Nutation::IAU2000A (equal to the full precision (uas) IAU2000)
76 // <li> Nutation::IAU2000B (official lower precision (mas) of IAU2000)
77 // </ul>
78 // Epochs can be specified as the MJD (with defined constants MeasData::MJD2000
79 // and MeasData::MJDB1950 or the actual MJD),
80 // leading to the following constructors:
81 // <ul>
82 // <li> Nutation() default; assuming STANDARD
83 // <li> Nutation(method)
84 // </ul>
85 // Actual Nutation for a certain Epoch is calculated by the () operator
86 // as Nutation(epoch), with epoch Double MJD. Values are returned as an
87 // <linkto class=Euler>Euler</linkto>.
88 // The derivative (d<sup>-1</sup>) can be obtained as well by
89 // derivative(epoch). <br>
90 // A Nutation can be re-initialed with a different method and/or zero
91 // epoch with the <src>init()</src> functions (same format as constructors).
92 // To bypass the full calculation actual returned values are calculated
93 // using the derivative if within about 2 hours (error less than about
94 // 10<sup>-5</sup> mas). A call to refresh() will re-initiate calculations
95 // from scratch.<br>
96 // The following details can be set with the
97 // <linkto class=Aipsrc>Aipsrc</linkto> mechanism:
98 // <ul>
99 // <li> measures.nutation.d_interval: approximation interval as time
100 // (fraction of days is default unit) over which linear approximation
101 // is used (default 0.04d (about 1 hour)).
102 // <li> measures.nutation.b_usejpl: use the JPL database nutations for
103 // IAU1980.
104 // Else analytical expression, relative error about 10<sup>-9</sup>
105 // Note that the JPL database to be used can be set with
106 // measures.jpl.ephemeris (at the moment of writing DE200
107 // (default), or DE405)
108 // <li> measures.nutation.b_useiers: use the IERS Database nutation
109 // corrections for IAU1980 (default False)
110 // </ul>
111 // </synopsis>
112 //
113 // <example>
114 // <srcblock>
115 // #include <casacore/measures/Measures.h>
116 // MVDirection pos(Quantity(10,"degree"),Quantity(-10.5,"degree"));
117 // // direction RA=10; DEC=-10.5
118 // Nutation mine(Nutation::IAU1980); // define nutation type
119 // RotMatrix rotat(mine(45837.0)); // rotation matrix for 84/05/17
120 // MVDirection new = rotat*pos; // apply nutation
121 // </srcblock>
122 // The normal way to use Nutation is by using the
123 // <linkto class=MeasConvert>MeasConvert</linkto> class.
124 // </example>
125 //
126 // <motivation>
127 // To calculate the Nutation angles. An alternate route could have been
128 // a global function, but having a simple container allows caching of some
129 // calculations for speed.<br>
130 // Using MJD (JD-2400000.5) rather than JD is for precision reasons.
131 // </motivation>
132 //
133 // <todo asof="2003/10/20">
134 // <li> Correct deval_p (derivative complimentary eqox terms)
135 // <li> Improve speed by a bit more lazyness in derivative calculations
136 // and separate eqox calculations
137 // </todo>
138 
139 class Nutation {
140  public:
141  //# Constants
142  // Interval to be used for linear approximation (in days)
143  static const Double INTV;
144 
145  //# Enumerations
146  // Types of known Nutation calculations (at 1995/09/04 STANDARD == IAU1980,
147  // after 2004/01/01 it will be IAU2000B))
151  STANDARD = IAU1980 };
152 
153  //# Constructors
154  // Default constructor, generates default J2000 Nutation identification
155  Nutation();
156  // Copy constructor
157  Nutation(const Nutation &other);
158  // Constructor with type
159  explicit Nutation(NutationTypes type);
160  // Copy assignment
161  Nutation &operator=(const Nutation &other);
162 
163  //# Destructor
164  ~Nutation();
165 
166  //# Operators
167  // Return the Nutation angles
168  const Euler &operator()(Double epoch);
169 
170  //# General Member Functions
171  // Return derivative of Nutation (d<sup>-1</sup>)
172  const Euler &derivative(Double epoch);
173 
174  // Re-initialise Nutation object
175  // <group>
176  void init();
177  void init(NutationTypes type);
178  // </group>
179 
180  // Refresh calculations
181  void refresh();
182 
183  // Get the equation of equinox
184  // <group>
185  Double eqox(Double epoch) ;
187  Quantity getEqoxAngle(Double epoch, const Unit &unit) ;
188  // </group>
189  // Get the derivative of the equation of equinoxes in d<sup>-1</sup>
191  // Get the complimentary terms of the equation of equinoxes
192  Double eqoxCT(Double epoch);
193  // Get the derivative of the complimentary terms of the equation of equinoxes
195 
196  private:
197 
198  //# Data members
199  // Method to be used
201  // Check epoch for linear approximation
203  // Check epoch for calculation of derivatives
205  // Cached calculated angles
207  // Cached derivatives
209  // Cached equation of equinoxes
211  // Cached derivative equation of equinoxes
213  // Cached complimentary terms equation of equinoxes
215  // Cached derivative of complimentary terms equation of equinoxes
217  // To be able to use references rather than copies, and also to use these
218  // references in simple (up to 4 terms of Nutation results) expressions,
219  // results are calculated in circulating buffer
221  // Last calculation
223  // Interpolation interval
225  // IERS use
227  // JPL use
229  //# Member functions
230  // Make a copy
231  void copy(const Nutation &other);
232  // Fill an empty copy
233  void fill();
234  // Calculate Nutation angles for time t; also derivatives if True given
235  void calcNut(Double t, Bool calcDer = False);
236 };
237 
238 
239 } //# NAMESPACE CASACORE - END
240 
241 #endif
242 
243 
Euler result_p[4]
Last calculation.
Definition: Nutation.h:222
int Int
Definition: aipstype.h:50
void calcNut(Double t, Bool calcDer=False)
Calculate Nutation angles for time t; also derivatives if True given.
void copy(const Nutation &other)
Make a copy.
NutationTypes
Types of known Nutation calculations (at 1995/09/04 STANDARD == IAU1980, after 2004/01/01 it will be ...
Definition: Nutation.h:148
Double derivativeEqox(Double epoch)
Get the derivative of the equation of equinoxes in d-1
Double eqeq_p
Cached equation of equinoxes.
Definition: Nutation.h:210
Double nval_p[3]
Cached calculated angles.
Definition: Nutation.h:206
Nutation()
Default constructor, generates default J2000 Nutation identification.
defines physical units
Definition: Unit.h:189
static uInt myUsejpl_reg
JPL use.
Definition: Nutation.h:228
Double checkDerEpoch_p
Check epoch for calculation of derivatives.
Definition: Nutation.h:204
void refresh()
Refresh calculations.
const Euler & operator()(Double epoch)
Return the Nutation angles.
double Double
Definition: aipstype.h:55
static uInt myInterval_reg
Interpolation interval.
Definition: Nutation.h:224
Double deqeq_p
Cached derivative equation of equinoxes.
Definition: Nutation.h:212
static uInt myUseiers_reg
IERS use.
Definition: Nutation.h:226
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Nutation & operator=(const Nutation &other)
Copy assignment.
NutationTypes method_p
Method to be used.
Definition: Nutation.h:200
const Bool False
Definition: aipstype.h:44
Nutation class and calculations.
Definition: Nutation.h:139
Double neval_p
Cached complimentary terms equation of equinoxes.
Definition: Nutation.h:214
Quantity getEqoxAngle(Double epoch)
Double dval_p[3]
Cached derivatives.
Definition: Nutation.h:208
Double eqoxCT(Double epoch)
Get the complimentary terms of the equation of equinoxes.
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:220
void init()
Re-initialise Nutation object.
Double deval_p
Cached derivative of complimentary terms equation of equinoxes.
Definition: Nutation.h:216
static const Double INTV
Interval to be used for linear approximation (in days)
Definition: Nutation.h:143
Double derivativeEqoxCT(Double epoch)
Get the derivative of the complimentary terms of the equation of equinoxes.
const Euler & derivative(Double epoch)
Return derivative of Nutation (d-1)
unsigned int uInt
Definition: aipstype.h:51
void fill()
Fill an empty copy.
Double eqox(Double epoch)
Get the equation of equinox.
Double checkEpoch_p
Check epoch for linear approximation.
Definition: Nutation.h:202
Vector of Euler rotation angles.
Definition: Euler.h:116