casa
$Rev:20696$
|
00001 //# MeasMath.h: Measure conversion aid routines 00002 //# Copyright (C) 1998,2000,2002-2004,2007 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: MeasMath.h 20615 2009-06-09 02:16:01Z Malte.Marquarding $ 00028 00029 #ifndef MEASURES_MEASMATH_H 00030 #define MEASURES_MEASMATH_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <casa/Quanta/Euler.h> 00035 #include <casa/Quanta/RotMatrix.h> 00036 #include <casa/Quanta/MVPosition.h> 00037 #include <casa/Quanta/MVDirection.h> 00038 #include <measures/Measures/MeasFrame.h> 00039 00040 namespace casa { //# NAMESPACE CASA - BEGIN 00041 00042 //# Forward Declarations 00043 class Measure; 00044 class MRBase; 00045 class Precession; 00046 class Nutation; 00047 class SolarPos; 00048 class Aberration; 00049 00050 //# Typedefs 00051 00052 // <summary> Measure conversion aid routines </summary> 00053 00054 // <use visibility=local> 00055 00056 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos=""> 00057 // </reviewed> 00058 00059 // <prerequisite> 00060 // <li> <linkto class=Measure>MeasConvert</linkto> class 00061 // <li> <linkto class=MConvertBase>overall conversion</linkto> class 00062 // </prerequisite> 00063 // 00064 // <etymology> 00065 // Measure and Mathematics 00066 // </etymology> 00067 // 00068 // <synopsis> 00069 // The conversion of measures like MDirection, MPosition etc have many 00070 // conversion routines in common. This class combines all of these 00071 // conversions, including data caches for re-use. 00072 // 00073 // The class is always created by the default constructor. For each operation 00074 // (like e.g. Precession application), it has three function: 00075 // <ul> 00076 // <li> create(): create an instance of the data necessary to convert 00077 // <li> apply(): apply the conversion (in the sense of from standard to 00078 // perturbed (e.g. from J2000 to TOPO)) 00079 // <li> deapply(): in the reverse direction of apply 00080 // </ul> 00081 // </synopsis> 00082 // 00083 // <example> 00084 // See <linkto class=MCDirection>MCDirection</linkto> source for how to use 00085 // the class. 00086 // </example> 00087 // 00088 // <motivation> To re-use code for a specific measure conversion, and to ease 00089 // the caching administration for each individual conversion. 00090 // </motivation> 00091 // 00092 // <todo asof="1998/09/30"> 00093 // <li> Nothing I know of 00094 // </todo> 00095 00096 class MeasMath { 00097 00098 public: 00099 00100 //# Constructors 00101 // Default constructor 00102 MeasMath(); 00103 00104 //# Destructor 00105 ~MeasMath(); 00106 00107 //# Member functions 00108 // Initialise the frame to be used. The apply direction uses the 00109 // inref if present; the deapply the outref if present, otherwise the 00110 // other one. 00111 void initFrame(MRBase &outref, MRBase &inref); 00112 00113 // Functions to create a particular conversion instance; to apply 00114 // or deapply the instance. 00115 // <group> 00116 // Precession for J2000 (IAU definition) and in coordinates 00117 // <group> 00118 void createPrecession(); 00119 void applyPrecession(MVPosition &in); 00120 void deapplyPrecession(MVPosition &in); 00121 // </group> 00122 // Precession for B1950 and in coordinates 00123 // <group> 00124 void createPrecessionB1950(); 00125 void applyPrecessionB1950(MVPosition &in); 00126 void deapplyPrecessionB1950(MVPosition &in); 00127 // </group> 00128 // Nutation for J2000 (IAU standard) and in coordinates 00129 // <group> 00130 void createNutation(); 00131 void applyNutation(MVPosition &in); 00132 void deapplyNutation(MVPosition &in); 00133 // </group> 00134 // Nutation for B1950 and in coordinates 00135 // <group> 00136 void createNutationB1950(); 00137 void applyNutationB1950(MVPosition &in); 00138 void deapplyNutationB1950(MVPosition &in); 00139 // </group> 00140 // Precession and Nutation for J2000 or B1950 and in coordinates 00141 // <group> 00142 void createPrecNutat(); 00143 void applyPrecNutat(MVPosition &in); 00144 void deapplyPrecNutat(MVPosition &in); 00145 void createPrecNutatB1950(); 00146 void applyPrecNutatB1950(MVPosition &in, Bool doin=True); 00147 void deapplyPrecNutatB1950(MVPosition &in, Bool doin=True); 00148 // </group> 00149 // Aberration for J2000 (IAU definition) and B1950 and in coordinates 00150 // <group> 00151 void createAberration(); 00152 void applyAberration(MVPosition &in, Bool doin=True); 00153 void deapplyAberration(MVPosition &in, Bool doin=True); 00154 void createAberrationB1950(); 00155 void applyAberrationB1950(MVPosition &in, Bool doin=True); 00156 void deapplyAberrationB1950(MVPosition &in, Bool doin=True); 00157 // </group> 00158 // Solar bending for J2000 (IAU definition) and in coordinates. 00159 // False if dependent on frame direction rather than input one. 00160 // <group> 00161 void createSolarPos(); 00162 void applySolarPos(MVPosition &in, Bool doin=True); 00163 void deapplySolarPos(MVPosition &in, Bool doin=True); 00164 // </group> 00165 // Various conversions 00166 // <group> 00167 void applyHADECtoITRF(MVPosition &in); 00168 void deapplyHADECtoITRF(MVPosition &in); 00169 void applyHADECtoAZEL(MVPosition &in); 00170 void deapplyHADECtoAZEL(MVPosition &in); 00171 void applyHADECtoAZELGEO(MVPosition &in); 00172 void deapplyHADECtoAZELGEO(MVPosition &in); 00173 void applyJ2000toB1950(MVPosition &in, Double epo, Bool doin); 00174 void deapplyJ2000toB1950(MVPosition &in, Double epo, Bool doin); 00175 void applyJ2000toB1950(MVPosition &in, Bool doin=True); 00176 void deapplyJ2000toB1950(MVPosition &in, Bool doin=True); 00177 void applyJ2000toB1950_VLA(MVPosition &in, Bool doin=True); 00178 void deapplyJ2000toB1950_VLA(MVPosition &in, Bool doin=True); 00179 void applyETerms(MVPosition &in, Bool doin=True, Double epo=2000.0); 00180 void deapplyETerms(MVPosition &in, Bool doin=True, Double epo=2000.0); 00181 void applyGALtoJ2000(MVPosition &in); 00182 void deapplyGALtoJ2000(MVPosition &in); 00183 void applyGALtoB1950(MVPosition &in); 00184 void deapplyGALtoB1950(MVPosition &in); 00185 void applyGALtoSUPERGAL(MVPosition &in); 00186 void deapplyGALtoSUPERGAL(MVPosition &in); 00187 void applyICRStoJ2000(MVPosition &in); 00188 void deapplyICRStoJ2000(MVPosition &in); 00189 void applyTOPOtoHADEC(MVPosition &in, Bool doin=True); 00190 void deapplyTOPOtoHADEC(MVPosition &in, Bool doin=True); 00191 void applyPolarMotion(MVPosition &in); 00192 void deapplyPolarMotion(MVPosition &in); 00193 void applyAZELtoAZELSW(MVPosition &in); 00194 void applyECLIPtoJ2000(MVPosition &in); 00195 void deapplyECLIPtoJ2000(MVPosition &in); 00196 void applyMECLIPtoJMEAN(MVPosition &in); 00197 void deapplyMECLIPtoJMEAN(MVPosition &in); 00198 void applyTECLIPtoJTRUE(MVPosition &in); 00199 void deapplyTECLIPtoJTRUE(MVPosition &in); 00200 void applyAPPtoTOPO(MVPosition &in, const Double len, 00201 Bool doin=True); 00202 void deapplyAPPtoTOPO(MVPosition &in, const Double len, 00203 Bool doin=True); 00204 // </group> 00205 // </group> 00206 00207 // Transfer some information 00208 // <group> 00209 void getAPP(MVPosition &out); 00210 void getJ2000(MVPosition &out); 00211 void getB1950(MVPosition &out); 00212 // </group> 00213 00214 private: 00215 //# Enum 00216 // Types of frame information groups 00217 enum FrameType { 00218 EPOCH = 0, 00219 POSITION, 00220 DIRECTION, 00221 VELOCITY, 00222 N_FrameType }; 00223 // Types of frame information 00224 enum FrameInfo { 00225 TDB = 0, 00226 LASTR, 00227 TT, 00228 UT1, 00229 LONG, 00230 LAT, 00231 RADIUS, 00232 LATGEO, 00233 J2000LONG, 00234 J2000LAT, 00235 B1950LONG, 00236 B1950LAT, 00237 APPLONG, 00238 APPLAT, 00239 N_FrameDInfo, 00240 J2000DIR = N_FrameDInfo, 00241 B1950DIR, 00242 APPDIR, 00243 N_FrameInfo, 00244 N_FrameMVDInfo = N_FrameInfo-J2000DIR }; 00245 00246 //# Typedefs 00247 // To get frame group 00248 typedef const Measure* (MeasFrame::*FRFCT)() const; 00249 // To get frame info 00250 // <group> 00251 typedef Bool (MeasFrame::*FRDINFO)(Double &) const; 00252 typedef Bool (MeasFrame::*FRMVDINFO)(MVDirection &) const; 00253 // </group> 00254 00255 //# Cached Data 00256 // Data cached for fast calculations and workspace 00257 // <group> 00258 // Frame information 00259 // <group> 00260 Bool inOK_p; 00261 Bool outOK_p; 00262 Bool frameOK_p[N_FrameType]; 00263 MeasFrame *inFrame_p; 00264 MeasFrame *outFrame_p; 00265 MeasFrame *applyFrame_p[N_FrameType]; 00266 MeasFrame *deapplyFrame_p[N_FrameType]; 00267 // </group> 00268 // Conversion information 00269 // <group> 00270 SolarPos *SOLPOSIAU; 00271 Aberration *ABERIAU, *ABERB1950; 00272 Nutation *NUTATIAU, *NUTATB1950; 00273 Precession *PRECESIAU, *PRECESB1950; 00274 // </group> 00275 // Workspace 00276 // <group> 00277 Euler EULER1; 00278 RotMatrix ROTMAT1; 00279 MVPosition MVPOS1, MVPOS2, MVPOS3, MVPOS4; 00280 Double g1, g2, g3, lengthE; 00281 Bool infoOK_p[N_FrameInfo]; 00282 Double info_p[N_FrameDInfo]; 00283 MVDirection infomvd_p[N_FrameMVDInfo]; 00284 // </group> 00285 // Aipsrc definition for B1950 epoch (in years) 00286 static uInt b1950_reg_p; 00287 00288 // </group> 00289 00290 //# Constructors 00291 // Copy constructor (not implemented) 00292 MeasMath(const MeasMath &other); 00293 // Assignment (not implemented) 00294 MeasMath &operator=(const MeasMath &other); 00295 00296 //# Member functions 00297 // Get proper frame information 00298 void getFrame(FrameType i); 00299 00300 // Get information from the frame 00301 // <thrown> 00302 // <li> AipsError if information not available; or False return if 00303 // <em>ret=True</em> 00304 // </thrown> 00305 // <group> 00306 Bool getInfo(FrameInfo i, Bool ret=False); 00307 // </group> 00308 00309 // Make a shift of coordinate into a rotation and apply it when doin is 00310 // False. Else apply a shift. 00311 // Given are the longitude and latitude codes of the direction to be used, 00312 // and the shift to be applied in that system to the in coordinate. 00313 void rotateShift(MVPosition &in, const MVPosition &shft, 00314 const FrameInfo lng, const FrameInfo lat, 00315 Bool doin); 00316 }; 00317 00318 00319 } //# NAMESPACE CASA - END 00320 00321 #endif