casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeasMath.h
Go to the documentation of this file.
1 //# MeasMath.h: Measure conversion aid routines
2 //# Copyright (C) 1998,2000,2002-2004,2007
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_MEASMATH_H
30 #define MEASURES_MEASMATH_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 //# Forward Declarations
43 class Measure;
44 class MRBase;
45 class Precession;
46 class Nutation;
47 class SolarPos;
48 class Aberration;
49 
50 //# Typedefs
51 
52 // <summary> Measure conversion aid routines </summary>
53 
54 // <use visibility=local>
55 
56 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
57 // </reviewed>
58 
59 // <prerequisite>
60 // <li> <linkto class=Measure>MeasConvert</linkto> class
61 // <li> <linkto class=MConvertBase>overall conversion</linkto> class
62 // </prerequisite>
63 //
64 // <etymology>
65 // Measure and Mathematics
66 // </etymology>
67 //
68 // <synopsis>
69 // The conversion of measures like MDirection, MPosition etc have many
70 // conversion routines in common. This class combines all of these
71 // conversions, including data caches for re-use.
72 //
73 // The class is always created by the default constructor. For each operation
74 // (like e.g. Precession application), it has three function:
75 // <ul>
76 // <li> create(): create an instance of the data necessary to convert
77 // <li> apply(): apply the conversion (in the sense of from standard to
78 // perturbed (e.g. from J2000 to TOPO))
79 // <li> deapply(): in the reverse direction of apply
80 // </ul>
81 // </synopsis>
82 //
83 // <example>
84 // See <linkto class=MCDirection>MCDirection</linkto> source for how to use
85 // the class.
86 // </example>
87 //
88 // <motivation> To re-use code for a specific measure conversion, and to ease
89 // the caching administration for each individual conversion.
90 // </motivation>
91 //
92 // <todo asof="1998/09/30">
93 // <li> Nothing I know of
94 // </todo>
95 
96 class MeasMath {
97 
98 public:
99 
100  //# Constructors
101  // Default constructor
102  MeasMath();
103 
104  //# Destructor
105  ~MeasMath();
106 
107  //# Member functions
108  // Initialise the frame to be used. The apply direction uses the
109  // inref if present; the deapply the outref if present, otherwise the
110  // other one.
111  void initFrame(MRBase &outref, MRBase &inref);
112 
113  // Functions to create a particular conversion instance; to apply
114  // or deapply the instance.
115  // <group>
116  // Precession for J2000 (IAU definition) and in coordinates
117  // <group>
118  void createPrecession();
119  void applyPrecession(MVPosition &in);
120  void deapplyPrecession(MVPosition &in);
121  // </group>
122  // Precession for B1950 and in coordinates
123  // <group>
124  void createPrecessionB1950();
127  // </group>
128  // Nutation for J2000 (IAU standard) and in coordinates
129  // <group>
130  void createNutation();
131  void applyNutation(MVPosition &in);
132  void deapplyNutation(MVPosition &in);
133  // </group>
134  // Nutation for B1950 and in coordinates
135  // <group>
136  void createNutationB1950();
137  void applyNutationB1950(MVPosition &in);
139  // </group>
140  // Precession and Nutation for J2000 or B1950 and in coordinates
141  // <group>
142  void createPrecNutat();
143  void applyPrecNutat(MVPosition &in);
144  void deapplyPrecNutat(MVPosition &in);
145  void createPrecNutatB1950();
146  void applyPrecNutatB1950(MVPosition &in, Bool doin=True);
147  void deapplyPrecNutatB1950(MVPosition &in, Bool doin=True);
148  // </group>
149  // Aberration for J2000 (IAU definition) and B1950 and in coordinates
150  // <group>
151  void createAberration();
152  void applyAberration(MVPosition &in, Bool doin=True);
153  void deapplyAberration(MVPosition &in, Bool doin=True);
154  void createAberrationB1950();
155  void applyAberrationB1950(MVPosition &in, Bool doin=True);
156  void deapplyAberrationB1950(MVPosition &in, Bool doin=True);
157  // </group>
158  // Solar bending for J2000 (IAU definition) and in coordinates.
159  // False if dependent on frame direction rather than input one.
160  // <group>
161  void createSolarPos();
162  void applySolarPos(MVPosition &in, Bool doin=True);
163  void deapplySolarPos(MVPosition &in, Bool doin=True);
164  // </group>
165  // Various conversions
166  // <group>
167  void applyHADECtoITRF(MVPosition &in);
168  void deapplyHADECtoITRF(MVPosition &in);
169  void applyHADECtoAZEL(MVPosition &in);
170  void deapplyHADECtoAZEL(MVPosition &in);
173  void applyJ2000toB1950(MVPosition &in, Double epo, Bool doin);
174  void deapplyJ2000toB1950(MVPosition &in, Double epo, Bool doin);
175  void applyJ2000toB1950(MVPosition &in, Bool doin=True);
176  void deapplyJ2000toB1950(MVPosition &in, Bool doin=True);
177  void applyJ2000toB1950_VLA(MVPosition &in, Bool doin=True);
179  void applyETerms(MVPosition &in, Bool doin=True, Double epo=2000.0);
180  void deapplyETerms(MVPosition &in, Bool doin=True, Double epo=2000.0);
181  void applyGALtoJ2000(MVPosition &in);
182  void deapplyGALtoJ2000(MVPosition &in);
183  void applyGALtoB1950(MVPosition &in);
184  void deapplyGALtoB1950(MVPosition &in);
185  void applyGALtoSUPERGAL(MVPosition &in);
187  void applyICRStoJ2000(MVPosition &in);
188  void deapplyICRStoJ2000(MVPosition &in);
189  void applyTOPOtoHADEC(MVPosition &in, Bool doin=True);
190  void deapplyTOPOtoHADEC(MVPosition &in, Bool doin=True);
191  void applyPolarMotion(MVPosition &in);
192  void deapplyPolarMotion(MVPosition &in);
193  void applyAZELtoAZELSW(MVPosition &in);
194  void applyECLIPtoJ2000(MVPosition &in);
196  void applyMECLIPtoJMEAN(MVPosition &in);
198  void applyTECLIPtoJTRUE(MVPosition &in);
200  void applyAPPtoTOPO(MVPosition &in, const Double len,
201  Bool doin=True);
202  void deapplyAPPtoTOPO(MVPosition &in, const Double len,
203  Bool doin=True);
204  // </group>
205  // </group>
206 
207  // Transfer some information
208  // <group>
209  void getAPP(MVPosition &out);
210  void getJ2000(MVPosition &out);
211  void getB1950(MVPosition &out);
212  // </group>
213 
214 private:
215  //# Enum
216  // Types of frame information groups
217  enum FrameType {
218  EPOCH = 0,
223  // Types of frame information
224  enum FrameInfo {
225  TDB = 0,
227  TT,
245 
246  //# Typedefs
247  // To get frame group
248  typedef const Measure* (MeasFrame::*FRFCT)() const;
249  // To get frame info
250  // <group>
251  typedef Bool (MeasFrame::*FRDINFO)(Double &) const;
252  typedef Bool (MeasFrame::*FRMVDINFO)(MVDirection &) const;
253  // </group>
254 
255  //# Cached Data
256  // Data cached for fast calculations and workspace
257  // <group>
258  // Frame information
259  // <group>
267  // </group>
268  // Conversion information
269  // <group>
274  // </group>
275  // Workspace
276  // <group>
283  // </group>
284  // Aipsrc definition for B1950 epoch (in years)
286 
287  // </group>
288 
289  //# Constructors
290  // Copy constructor (not implemented)
291  MeasMath(const MeasMath &other);
292  // Assignment (not implemented)
293  MeasMath &operator=(const MeasMath &other);
294 
295  //# Member functions
296  // Get proper frame information
297  void getFrame(FrameType i);
298 
299  // Get information from the frame
300  // <thrown>
301  // <li> AipsError if information not available; or False return if
302  // <em>ret=True</em>
303  // </thrown>
304  // <group>
305  Bool getInfo(FrameInfo i, Bool ret=False);
306  // </group>
307 
308  // Make a shift of coordinate into a rotation and apply it when doin is
309  // False. Else apply a shift.
310  // Given are the longitude and latitude codes of the direction to be used,
311  // and the shift to be applied in that system to the in coordinate.
312  void rotateShift(MVPosition &in, const MVPosition &shft,
313  const FrameInfo lng, const FrameInfo lat,
314  Bool doin);
315 };
316 
317 
318 } //# NAMESPACE CASACORE - END
319 
320 #endif
void applyMECLIPtoJMEAN(MVPosition &in)
void applyHADECtoAZEL(MVPosition &in)
Nutation * NUTATB1950
Definition: MeasMath.h:272
MVDirection infomvd_p[N_FrameMVDInfo]
Definition: MeasMath.h:282
const Measure *(MeasFrame::* FRFCT)() const
To get frame group.
Definition: MeasMath.h:248
void applyGALtoSUPERGAL(MVPosition &in)
void deapplySolarPos(MVPosition &in, Bool doin=True)
Precession * PRECESIAU
Definition: MeasMath.h:273
void deapplyAPPtoTOPO(MVPosition &in, const Double len, Bool doin=True)
MeasFrame * applyFrame_p[N_FrameType]
Definition: MeasMath.h:265
void applyNutation(MVPosition &in)
void applyPrecNutatB1950(MVPosition &in, Bool doin=True)
Bool(MeasFrame::* FRMVDINFO)(MVDirection &) const
Definition: MeasMath.h:252
Bool(MeasFrame::* FRDINFO)(Double &) const
To get frame info.
Definition: MeasMath.h:251
void applyICRStoJ2000(MVPosition &in)
Base for Reference frame for physical measures.
Definition: MRBase.h:103
void applySolarPos(MVPosition &in, Bool doin=True)
Aberration * ABERIAU
Definition: MeasMath.h:271
void getFrame(FrameType i)
Get proper frame information.
MeasMath()
Default constructor.
void deapplyNutationB1950(MVPosition &in)
void deapplyMECLIPtoJMEAN(MVPosition &in)
void deapplyHADECtoITRF(MVPosition &in)
void applyHADECtoITRF(MVPosition &in)
Various conversions.
void deapplyECLIPtoJ2000(MVPosition &in)
void applyPrecession(MVPosition &in)
void deapplyETerms(MVPosition &in, Bool doin=True, Double epo=2000.0)
Measure conversion aid routines.
Definition: MeasMath.h:96
void createPrecessionB1950()
Precession for B1950 and in coordinates.
Double info_p[N_FrameDInfo]
Definition: MeasMath.h:281
FrameInfo
Types of frame information.
Definition: MeasMath.h:224
Bool frameOK_p[N_FrameType]
Definition: MeasMath.h:262
Container for Measure frame.
Definition: MeasFrame.h:137
Physical quantities within reference frame.
Definition: Measure.h:235
void applyPrecessionB1950(MVPosition &in)
MVPosition MVPOS2
Definition: MeasMath.h:278
MVPosition MVPOS4
Definition: MeasMath.h:278
void deapplyPolarMotion(MVPosition &in)
void applyHADECtoAZELGEO(MVPosition &in)
void applyAberration(MVPosition &in, Bool doin=True)
A 3x3 rotation matrix.
Definition: RotMatrix.h:85
MVPosition MVPOS1
Definition: MeasMath.h:278
void createSolarPos()
Solar bending for J2000 (IAU definition) and in coordinates.
void deapplyHADECtoAZELGEO(MVPosition &in)
void applyAPPtoTOPO(MVPosition &in, const Double len, Bool doin=True)
MeasFrame * deapplyFrame_p[N_FrameType]
Definition: MeasMath.h:266
void createNutation()
Nutation for J2000 (IAU standard) and in coordinates.
void applyGALtoJ2000(MVPosition &in)
Bool infoOK_p[N_FrameInfo]
Definition: MeasMath.h:280
void createNutationB1950()
Nutation for B1950 and in coordinates.
void deapplyPrecessionB1950(MVPosition &in)
void applyETerms(MVPosition &in, Bool doin=True, Double epo=2000.0)
void deapplyAberrationB1950(MVPosition &in, Bool doin=True)
void deapplyPrecNutatB1950(MVPosition &in, Bool doin=True)
Precession class and calculations.
Definition: Precession.h:130
Nutation * NUTATIAU
Definition: MeasMath.h:272
void deapplyGALtoB1950(MVPosition &in)
static uInt b1950_reg_p
Aipsrc definition for B1950 epoch (in years)
Definition: MeasMath.h:285
void initFrame(MRBase &outref, MRBase &inref)
Initialise the frame to be used.
double Double
Definition: aipstype.h:55
RotMatrix ROTMAT1
Workspace.
Definition: MeasMath.h:277
void deapplyHADECtoAZEL(MVPosition &in)
void applyAberrationB1950(MVPosition &in, Bool doin=True)
void deapplyPrecNutat(MVPosition &in)
void deapplyGALtoJ2000(MVPosition &in)
void getJ2000(MVPosition &out)
void applyPrecNutat(MVPosition &in)
Precession * PRECESB1950
Definition: MeasMath.h:273
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A 3D vector in space.
Definition: MVPosition.h:113
FrameType
Types of frame information groups.
Definition: MeasMath.h:217
void deapplyAberration(MVPosition &in, Bool doin=True)
const Bool False
Definition: aipstype.h:44
void deapplyTECLIPtoJTRUE(MVPosition &in)
MeasMath & operator=(const MeasMath &other)
Assignment (not implemented)
void applyTECLIPtoJTRUE(MVPosition &in)
Nutation class and calculations.
Definition: Nutation.h:139
void applyECLIPtoJ2000(MVPosition &in)
void deapplyPrecession(MVPosition &in)
void deapplyJ2000toB1950(MVPosition &in, Double epo, Bool doin)
void deapplyGALtoSUPERGAL(MVPosition &in)
void createPrecNutatB1950()
void applyTOPOtoHADEC(MVPosition &in, Bool doin=True)
void deapplyICRStoJ2000(MVPosition &in)
Aberration class and calculations.
Definition: Aberration.h:109
void rotateShift(MVPosition &in, const MVPosition &shft, const FrameInfo lng, const FrameInfo lat, Bool doin)
Make a shift of coordinate into a rotation and apply it when doin is False.
MeasFrame * inFrame_p
Definition: MeasMath.h:263
void applyNutationB1950(MVPosition &in)
Bool getInfo(FrameInfo i, Bool ret=False)
Get information from the frame.
void createPrecNutat()
Precession and Nutation for J2000 or B1950 and in coordinates.
void deapplyTOPOtoHADEC(MVPosition &in, Bool doin=True)
void applyAZELtoAZELSW(MVPosition &in)
void applyJ2000toB1950(MVPosition &in, Double epo, Bool doin)
MVPosition MVPOS3
Definition: MeasMath.h:278
Aberration * ABERB1950
Definition: MeasMath.h:271
void deapplyNutation(MVPosition &in)
void createAberrationB1950()
void applyPolarMotion(MVPosition &in)
void createPrecession()
Functions to create a particular conversion instance; to apply or deapply the instance.
Vector of three direction cosines.
Definition: MVDirection.h:107
void getAPP(MVPosition &out)
Transfer some information.
void applyJ2000toB1950_VLA(MVPosition &in, Bool doin=True)
Solar position class and calculations.
Definition: SolarPos.h:111
MeasFrame * outFrame_p
Definition: MeasMath.h:264
void createAberration()
Aberration for J2000 (IAU definition) and B1950 and in coordinates.
void applyGALtoB1950(MVPosition &in)
const Bool True
Definition: aipstype.h:43
Bool inOK_p
Data cached for fast calculations and workspace.
Definition: MeasMath.h:260
SolarPos * SOLPOSIAU
Conversion information.
Definition: MeasMath.h:270
void getB1950(MVPosition &out)
unsigned int uInt
Definition: aipstype.h:51
void deapplyJ2000toB1950_VLA(MVPosition &in, Bool doin=True)