casa
$Rev:20696$
|
00001 //# Nutation.h: Nutation class 00002 //# Copyright (C) 1995,1996,1997,1998,2003,2004 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# 00027 //# $Id: Nutation.h 18093 2004-11-30 17:51:10Z ddebonis $ 00028 00029 #ifndef MEASURES_NUTATION_H 00030 #define MEASURES_NUTATION_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <casa/Quanta/Quantum.h> 00035 #include <casa/Quanta/Euler.h> 00036 00037 namespace casa { //# NAMESPACE CASA - BEGIN 00038 00039 //# Forward Declarations 00040 00041 // <summary> Nutation class and calculations </summary> 00042 00043 // <use visibility=export> 00044 00045 // <reviewed reviewer="Tim Cornwell" date="1996/07/01" tests="tMeasMath" 00046 // demos=""> 00047 // </reviewed> 00048 00049 // <prerequisite> 00050 // <li> <linkto class=Measure>Measure</linkto> class 00051 // <li> <linkto class=Euler>Euler</linkto> 00052 // <li> <linkto class=MeasData>MeasData</linkto> class for constants 00053 // </prerequisite> 00054 // 00055 // <etymology> 00056 // Nutation 00057 // </etymology> 00058 // 00059 // <synopsis> 00060 // Nutation forms the class for Nutation calculations. It is a simple 00061 // container with the selected method, and the mean epoch. 00062 // It acts as a cache 00063 // for values and their derivatives, to enable fast calculations for time 00064 // epochs close together (see the <em>aipsrc</em> variable 00065 // <em>measures.nutation.d_interval</em>). 00066 // 00067 // The calculation method is selected from one of the following: 00068 // <ul> 00069 // <li> Nutation::STANDARD (at 1995/09/04 the IAU1980 definition, 00070 // from 2004/01/01 IAU2000B) 00071 // <li> Nutation::NONE (nutation of zero returned) 00072 // <li> Nutation::IAU1980 00073 // <li> Nutation::B1950 00074 // <li> Nutation::IAU2000 00075 // <li> Nutation::IAU2000A (equal to the full precision (uas) IAU2000) 00076 // <li> Nutation::IAU2000B (official lower precision (mas) of IAU2000) 00077 // </ul> 00078 // Epochs can be specified as the MJD (with defined constants MeasData::MJD2000 00079 // and MeasData::MJDB1950 or the actual MJD), 00080 // leading to the following constructors: 00081 // <ul> 00082 // <li> Nutation() default; assuming STANDARD 00083 // <li> Nutation(method) 00084 // </ul> 00085 // Actual Nutation for a certain Epoch is calculated by the () operator 00086 // as Nutation(epoch), with epoch Double MJD. Values are returned as an 00087 // <linkto class=Euler>Euler</linkto>. 00088 // The derivative (d<sup>-1</sup>) can be obtained as well by 00089 // derivative(epoch). <br> 00090 // A Nutation can be re-initialed with a different method and/or zero 00091 // epoch with the <src>init()</src> functions (same format as constructors). 00092 // To bypass the full calculation actual returned values are calculated 00093 // using the derivative if within about 2 hours (error less than about 00094 // 10<sup>-5</sup> mas). A call to refresh() will re-initiate calculations 00095 // from scratch.<br> 00096 // The following details can be set with the 00097 // <linkto class=Aipsrc>Aipsrc</linkto> mechanism: 00098 // <ul> 00099 // <li> measures.nutation.d_interval: approximation interval as time 00100 // (fraction of days is default unit) over which linear approximation 00101 // is used (default 0.04d (about 1 hour)). 00102 // <li> measures.nutation.b_usejpl: use the JPL database nutations for 00103 // IAU1980. 00104 // Else analytical expression, relative error about 10<sup>-9</sup> 00105 // Note that the JPL database to be used can be set with 00106 // measures.jpl.ephemeris (at the moment of writing DE200 00107 // (default), or DE405) 00108 // <li> measures.nutation.b_useiers: use the IERS Database nutation 00109 // corrections for IAU1980 (default False) 00110 // </ul> 00111 // </synopsis> 00112 // 00113 // <example> 00114 // <srcblock> 00115 // #include <measures/Measures.h> 00116 // MVDirection pos(Quantity(10,"degree"),Quantity(-10.5,"degree")); 00117 // // direction RA=10; DEC=-10.5 00118 // Nutation mine(Nutation::IAU1980); // define nutation type 00119 // RotMatrix rotat(mine(45837.0)); // rotation matrix for 84/05/17 00120 // MVDirection new = rotat*pos; // apply nutation 00121 // </srcblock> 00122 // The normal way to use Nutation is by using the 00123 // <linkto class=MeasConvert>MeasConvert</linkto> class. 00124 // </example> 00125 // 00126 // <motivation> 00127 // To calculate the Nutation angles. An alternate route could have been 00128 // a global function, but having a simple container allows caching of some 00129 // calculations for speed.<br> 00130 // Using MJD (JD-2400000.5) rather than JD is for precision reasons. 00131 // </motivation> 00132 // 00133 // <todo asof="2003/10/20"> 00134 // <li> Correct deval_p (derivative complimentary eqox terms) 00135 // <li> Improve speed by a bit more lazyness in derivative calculations 00136 // and separate eqox calculations 00137 // </todo> 00138 00139 class Nutation { 00140 public: 00141 //# Constants 00142 // Interval to be used for linear approximation (in days) 00143 static const Double INTV; 00144 00145 //# Enumerations 00146 // Types of known Nutation calculations (at 1995/09/04 STANDARD == IAU1980, 00147 // after 2004/01/01 it will be IAU2000B)) 00148 enum NutationTypes { 00149 NONE, IAU1980, B1950, IAU2000A, IAU2000B, 00150 IAU2000 = IAU2000A, 00151 STANDARD = IAU1980 }; 00152 00153 //# Constructors 00154 // Default constructor, generates default J2000 Nutation identification 00155 Nutation(); 00156 // Copy constructor 00157 Nutation(const Nutation &other); 00158 // Constructor with type 00159 explicit Nutation(NutationTypes type); 00160 // Copy assignment 00161 Nutation &operator=(const Nutation &other); 00162 00163 //# Destructor 00164 ~Nutation(); 00165 00166 //# Operators 00167 // Return the Nutation angles 00168 const Euler &operator()(Double epoch); 00169 00170 //# General Member Functions 00171 // Return derivative of Nutation (d<sup>-1</sup>) 00172 const Euler &derivative(Double epoch); 00173 00174 // Re-initialise Nutation object 00175 // <group> 00176 void init(); 00177 void init(NutationTypes type); 00178 // </group> 00179 00180 // Refresh calculations 00181 void refresh(); 00182 00183 // Get the equation of equinox 00184 // <group> 00185 Double eqox(Double epoch) ; 00186 Quantity getEqoxAngle(Double epoch); 00187 Quantity getEqoxAngle(Double epoch, const Unit &unit) ; 00188 // </group> 00189 // Get the derivative of the equation of equinoxes in d<sup>-1</sup> 00190 Double derivativeEqox(Double epoch); 00191 // Get the complimentary terms of the equation of equinoxes 00192 Double eqoxCT(Double epoch); 00193 // Get the derivative of the complimentary terms of the equation of equinoxes 00194 Double derivativeEqoxCT(Double epoch); 00195 00196 private: 00197 00198 //# Data members 00199 // Method to be used 00200 NutationTypes method_p; 00201 // Check epoch for linear approximation 00202 Double checkEpoch_p; 00203 // Check epoch for calculation of derivatives 00204 Double checkDerEpoch_p; 00205 // Cached calculated angles 00206 Double nval_p[3]; 00207 // Cached derivatives 00208 Double dval_p[3]; 00209 // Cached equation of equinoxes 00210 Double eqeq_p; 00211 // Cached derivative equation of equinoxes 00212 Double deqeq_p; 00213 // Cached complimentary terms equation of equinoxes 00214 Double neval_p; 00215 // Cached derivative of complimentary terms equation of equinoxes 00216 Double deval_p; 00217 // To be able to use references rather than copies, and also to use these 00218 // references in simple (up to 4 terms of Nutation results) expressions, 00219 // results are calculated in circulating buffer 00220 Int lres_p; 00221 // Last calculation 00222 Euler result_p[4]; 00223 // Interpolation interval 00224 static uInt myInterval_reg; 00225 // IERS use 00226 static uInt myUseiers_reg; 00227 // JPL use 00228 static uInt myUsejpl_reg; 00229 //# Member functions 00230 // Make a copy 00231 void copy(const Nutation &other); 00232 // Fill an empty copy 00233 void fill(); 00234 // Calculate Nutation angles for time t; also derivatives if True given 00235 void calcNut(Double t, Bool calcDer = False); 00236 }; 00237 00238 00239 } //# NAMESPACE CASA - END 00240 00241 #endif 00242 00243