casa
$Rev:20696$
|
00001 //# MCuvw.h: Muvw conversion 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: MCuvw.h 21130 2011-10-18 07:39:05Z gervandiepen $ 00028 00029 #ifndef MEASURES_MCUVW_H 00030 #define MEASURES_MCUVW_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <measures/Measures/Muvw.h> 00035 #include <measures/Measures/MeasBase.h> 00036 #include <measures/Measures/MeasRef.h> 00037 #include <measures/Measures/MCBase.h> 00038 #include <measures/Measures/MConvertBase.h> 00039 #include <measures/Measures/MeasMath.h> 00040 #include <casa/Quanta/MVDirection.h> 00041 #include <casa/OS/Mutex.h> 00042 00043 namespace casa { //# NAMESPACE CASA - BEGIN 00044 00045 //# Forward Declarations 00046 class MCuvw; 00047 class String; 00048 template <class T> class Vector; 00049 00050 //# Typedefs 00051 00052 // <summary> Muvw conversion routines </summary> 00053 00054 // <use visibility=local> 00055 00056 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMuvw" demos=""> 00057 // </reviewed> 00058 00059 // <prerequisite> 00060 // <li> <linkto class=Measure>Measure</linkto> class 00061 // <li> <linkto class=MCBase>MCBase</linkto> base class 00062 // <li> <linkto class=MConvertBase>overall conversion</linkto> class 00063 // </prerequisite> 00064 // 00065 // <etymology> 00066 // Measure, Convert and uvw 00067 // </etymology> 00068 // 00069 // <synopsis> 00070 // Contains state machinery and caching for actual conversions 00071 // </synopsis> 00072 // 00073 // <example> 00074 // See <linkto module=Measures>Measures</linkto> module description for 00075 // conversion examples. 00076 // </example> 00077 // 00078 // <motivation> 00079 // </motivation> 00080 // 00081 // <todo asof="1998/04/21"> 00082 // <li> Cater for EW baselines 00083 // </todo> 00084 00085 class MCuvw : public MCBase { 00086 00087 public: 00088 00089 //# Friends 00090 // Conversion of data 00091 friend class MeasConvert<Muvw>; 00092 00093 //# Constructors 00094 // Default constructor 00095 MCuvw(); 00096 00097 //# Destructor 00098 ~MCuvw(); 00099 00100 //# Member functions 00101 // Show the state of the conversion engine (mainly for debugging purposes) 00102 static String showState(); 00103 00104 private: 00105 //# Enumerations 00106 // The list of actual routines provided. 00107 // <note role=warning> Each <src>AA_BB</src> in the list points to routine 00108 // that can be used in the FromTo list in the getConvert routine. 00109 // In addition the type to which each is converted should be in the 00110 // ToRef array, again in the proper order. </note> 00111 enum Routes { 00112 GAL_J2000, 00113 GAL_B1950, 00114 J2000_GAL, 00115 B1950_GAL, 00116 J2000_B1950, 00117 J2000_B1950_VLA, 00118 B1950_J2000, 00119 B1950_VLA_J2000, 00120 B1950_B1950_VLA, 00121 B1950_VLA_B1950, 00122 J2000_JMEAN, 00123 B1950_BMEAN, 00124 JMEAN_J2000, 00125 JMEAN_JTRUE, 00126 BMEAN_B1950, 00127 BMEAN_BTRUE, 00128 JTRUE_JMEAN, 00129 BTRUE_BMEAN, 00130 J2000_JNAT, 00131 JNAT_J2000, 00132 B1950_APP, 00133 APP_B1950, 00134 APP_TOPO, 00135 HADEC_AZEL, 00136 HADEC_AZELGEO, 00137 AZEL_HADEC, 00138 AZELGEO_HADEC, 00139 HADEC_TOPO, 00140 AZEL_AZELSW, 00141 AZELGEO_AZELSWGEO, 00142 AZELSW_AZEL, 00143 AZELSWGEO_AZELGEO, 00144 APP_JNAT, 00145 JNAT_APP, 00146 J2000_ECLIP, 00147 ECLIP_J2000, 00148 JMEAN_MECLIP, 00149 MECLIP_JMEAN, 00150 JTRUE_TECLIP, 00151 TECLIP_JTRUE, 00152 GAL_SUPERGAL, 00153 SUPERGAL_GAL, 00154 ITRF_HADEC, 00155 HADEC_ITRF, 00156 TOPO_HADEC, 00157 TOPO_APP, 00158 ICRS_J2000, 00159 J2000_ICRS, 00160 N_Routes 00161 }; 00162 00163 //# Typedefs 00164 00165 //# Operators 00166 00167 //# General Member Functions 00168 00169 //# Enumerations 00170 00171 //# Cached Data 00172 // Calculation class 00173 MeasMath measMath; 00174 // Belonging direction 00175 MVDirection MVDIR1; 00176 00177 //# State machine data 00178 // Transition list 00179 static uInt ToRef_p[N_Routes][3]; 00180 // Transition matrix 00181 static uInt FromTo_p[Muvw::N_Types][Muvw::N_Types]; 00182 // Mutex for thread-safety. 00183 static MutexedInit theirMutexedInit; 00184 00185 // Fill the global state in a thread-safe way. 00186 static void fillState() 00187 { theirMutexedInit.exec(); } 00188 00189 //# Constructors 00190 // Copy constructor (not implemented) 00191 MCuvw(const MCuvw &other); 00192 // Assignment (not implemented) 00193 MCuvw &operator=(const MCuvw &other); 00194 00195 //# Member functions 00196 00197 // Create conversion function pointer 00198 virtual void getConvert(MConvertBase &mc, 00199 const MRBase &inref, 00200 const MRBase &outref); 00201 00202 // Create help structures for Measure conversion routines 00203 virtual void initConvert(uInt which, MConvertBase &mc); 00204 00205 // Delete the pointers used in the MeasConvert help structure cache 00206 virtual void clearConvert(); 00207 00208 // Routines to convert uvws from one reference frame to another 00209 virtual void doConvert(MeasValue &in, 00210 MRBase &inref, 00211 MRBase &outref, 00212 const MConvertBase &mc); 00213 // Conversion routine to cater for inheritance question 00214 void doConvert(MVuvw &in, 00215 MRBase &inref, 00216 MRBase &outref, 00217 const MConvertBase &mc); 00218 // Get the correct belonging direction from the frame 00219 // <group> 00220 void getAPP(); 00221 void getJ2000(); 00222 void getB1950(); 00223 // </group> 00224 // Rotate from direction to pole 00225 void toPole(MVPosition &in); 00226 // Rotate from pole to direction 00227 void fromPole(MVPosition &in); 00228 00229 private: 00230 // Fill the global state in a thread-safe way. 00231 static void doFillState (void*); 00232 }; 00233 00234 00235 } //# NAMESPACE CASA - END 00236 00237 #endif 00238