casacore
MCuvw.h
Go to the documentation of this file.
1 //# MCuvw.h: Muvw conversion 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_MCUVW_H
30 #define MEASURES_MCUVW_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/measures/Measures/Muvw.h>
35 #include <casacore/measures/Measures/MeasBase.h>
36 #include <casacore/measures/Measures/MeasRef.h>
37 #include <casacore/measures/Measures/MCBase.h>
38 #include <casacore/measures/Measures/MConvertBase.h>
39 #include <casacore/measures/Measures/MeasMath.h>
40 #include <casacore/casa/Quanta/MVDirection.h>
41 #include <casacore/casa/OS/Mutex.h>
42 
43 namespace casacore { //# NAMESPACE CASACORE - BEGIN
44 
45 //# Forward Declarations
46 class MCuvw;
47 class String;
48 template <class T> class Vector;
49 
50 //# Typedefs
51 
52 // <summary> Muvw conversion routines </summary>
53 
54 // <use visibility=local>
55 
56 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMuvw" demos="">
57 // </reviewed>
58 
59 // <prerequisite>
60 // <li> <linkto class=Measure>Measure</linkto> class
61 // <li> <linkto class=MCBase>MCBase</linkto> base class
62 // <li> <linkto class=MConvertBase>overall conversion</linkto> class
63 // </prerequisite>
64 //
65 // <etymology>
66 // Measure, Convert and uvw
67 // </etymology>
68 //
69 // <synopsis>
70 // Contains state machinery and caching for actual conversions
71 // </synopsis>
72 //
73 // <example>
74 // See <linkto module=Measures>Measures</linkto> module description for
75 // conversion examples.
76 // </example>
77 //
78 // <motivation>
79 // </motivation>
80 //
81 // <todo asof="1998/04/21">
82 // <li> Cater for EW baselines
83 // </todo>
84 
85 class MCuvw : public MCBase {
86 
87 public:
88 
89  //# Friends
90  // Conversion of data
91  friend class MeasConvert<Muvw>;
92 
93  //# Constructors
94  // Default constructor
95  MCuvw();
96 
97  //# Destructor
98  ~MCuvw();
99 
100  //# Member functions
101  // Show the state of the conversion engine (mainly for debugging purposes)
102  static String showState();
103 
104 private:
105  //# Enumerations
106  // The list of actual routines provided.
107  // <note role=warning> Each <src>AA_BB</src> in the list points to routine
108  // that can be used in the FromTo list in the getConvert routine.
109  // In addition the type to which each is converted should be in the
110  // ToRef array, again in the proper order. </note>
111  enum Routes {
161  };
162 
163  //# Typedefs
164 
165  //# Operators
166 
167  //# General Member Functions
168 
169  //# Enumerations
170 
171  //# Cached Data
172  // Calculation class
174  // Belonging direction
176 
177  //# State machine data
178  // Transition list
179  static uInt ToRef_p[N_Routes][3];
180  // Transition matrix
182  // Mutex for thread-safety.
184 
185  // Fill the global state in a thread-safe way.
186  static void fillState()
187  { theirMutexedInit.exec(); }
188 
189  //# Constructors
190  // Copy constructor (not implemented)
191  MCuvw(const MCuvw &other);
192  // Assignment (not implemented)
193  MCuvw &operator=(const MCuvw &other);
194 
195  //# Member functions
196 
197  // Create conversion function pointer
198  virtual void getConvert(MConvertBase &mc,
199  const MRBase &inref,
200  const MRBase &outref);
201 
202  // Create help structures for Measure conversion routines
203  virtual void initConvert(uInt which, MConvertBase &mc);
204 
205  // Delete the pointers used in the MeasConvert help structure cache
206  virtual void clearConvert();
207 
208  // Routines to convert uvws from one reference frame to another
209  virtual void doConvert(MeasValue &in,
210  MRBase &inref,
211  MRBase &outref,
212  const MConvertBase &mc);
213  // Conversion routine to cater for inheritance question
214  void doConvert(MVuvw &in,
215  MRBase &inref,
216  MRBase &outref,
217  const MConvertBase &mc);
218  // Get the correct belonging direction from the frame
219  // <group>
220  void getAPP();
221  void getJ2000();
222  void getB1950();
223  // </group>
224  // Rotate from direction to pole
225  void toPole(MVPosition &in);
226  // Rotate from pole to direction
227  void fromPole(MVPosition &in);
228 
229 private:
230  // Fill the global state in a thread-safe way.
231  static void doFillState (void*);
232 };
233 
234 
235 } //# NAMESPACE CASACORE - END
236 
237 #endif
238 
static String showState()
Show the state of the conversion engine (mainly for debugging purposes)
virtual void initConvert(uInt which, MConvertBase &mc)
Create help structures for Measure conversion routines.
Conversion of Measures.
Definition: MBaseline.h:44
Routes
Each derived class should have a list of routines to be called:
Definition: MCBase.h:134
static MutexedInit theirMutexedInit
Mutex for thread-safety.
Definition: MCuvw.h:183
Base for Reference frame for physical measures.
Definition: MRBase.h:103
Muvw conversion routines.
Definition: MCuvw.h:85
static void fillState()
Fill the global state in a thread-safe way.
Definition: MCuvw.h:186
Base for specific measure conversions.
Definition: MCBase.h:119
virtual void clearConvert()
Delete the pointers used in the MeasConvert help structure cache.
void toPole(MVPosition &in)
Rotate from direction to pole.
A Measure: uvw on Earth.
Definition: Muvw.h:115
Measure conversion aid routines.
Definition: MeasMath.h:96
MVDirection MVDIR1
Belonging direction.
Definition: MCuvw.h:175
virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Routines to convert uvws from one reference frame to another.
MeasMath measMath
Calculation class.
Definition: MCuvw.h:173
Thread-safe initialization of global variables.
Definition: Mutex.h:161
MCuvw & operator=(const MCuvw &other)
Assignment (not implemented)
Base class for values in a Measure.
Definition: MeasValue.h:107
void fromPole(MVPosition &in)
Rotate from pole to direction.
A 3D vector in space.
Definition: MVPosition.h:113
A 3D vector on Earth.
Definition: MVuvw.h:110
static uInt FromTo_p[Muvw::N_Types][Muvw::N_Types]
Transition matrix.
Definition: MCuvw.h:181
void exec()
Execute the initialization function if not done yet.
Definition: Mutex.h:171
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static uInt ToRef_p[N_Routes][3]
Transition list.
Definition: MCuvw.h:179
Vector of three direction cosines.
Definition: MVDirection.h:106
static void doFillState(void *)
Fill the global state in a thread-safe way.
MCuvw()
Default constructor.
void getAPP()
Get the correct belonging direction from the frame.
this file contains all the compiler specific defines
Definition: mainpage.dox:28
virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref)
Create conversion function pointer.
unsigned int uInt
Definition: aipstype.h:51
Conversion of Measures Base.
Definition: MConvertBase.h:147