casacore
MEarthMagnetic.h
Go to the documentation of this file.
1 //# MEarthMagnetic.h: A Measure: Magnetic field on Earth
2 //# Copyright (C) 1995-1999,2000,2002,2004
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_MEARTHMAGNETIC_H
30 #define MEASURES_MEARTHMAGNETIC_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/measures/Measures/MeasBase.h>
35 #include <casacore/measures/Measures/MeasRef.h>
36 #include <casacore/casa/Quanta/MVEarthMagnetic.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class MEarthMagnetic;
42 class MCEarthMagnetic;
43 template <class M> class MeasConvert;
44 template <class M> class ArrayMeasColumn;
45 template <class M> class ScalarMeasColumn;
46 
47 //# Typedefs
48 
49 // <summary> A Measure: Magnetic field on Earth </summary>
50 
51 // <use visibility=export>
52 
53 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
54 // </reviewed>
55 
56 // <prerequisite>
57 // <li> <linkto class=Measure>Measure</linkto> class
58 // </prerequisite>
59 //
60 // <etymology>
61 // Earth and Magnetic field
62 // </etymology>
63 //
64 // <synopsis>
65 // MEarthMagnetic forms derived Measure class for Earth' magnetic flux density.
66 // The field can be specified as a model, or as a 3D vector (see
67 // <linkto class=MVEarthMagnetic>MVEarthMagnetic</linkto>) with a specified
68 // reference frame code. If a model is specified, a possibly specified
69 // explicit field will be ignored, since the field will be calculated from
70 // the model if a conversion is asked for.<br>
71 // The class contains the following magnetic field models:
72 // <ul>
73 // <li> IGRF international reference field
74 // </ul>
75 // The reference frame type can be any of the types specified in the
76 // <linkto class=MDirection>MDirection</linkto> direction types (e.g. AZEL).
77 // <note role=warning>
78 // The IGRF needs a Table of coefficients (at 5-year interval) </note>
79 //
80 // Conversion between field models is not supported (but not relevant
81 // anyway with only one model supported). Conversion to an explicit direction
82 // is done by the standard <linkto class=MeasConvert>MeasConvert</linkto>
83 // class and rules (see example) using <em>MEarthMagnetic::Convert</em>,
84 // and the reference types (e.g. MEarthMagnetic::AZEL).
85 //
86 // An <linkto class=EarthMagneticMachine> EarthMagneticMachine</linkto> has
87 // been provided to get e.g. the field in a certain direction at a
88 // certain height.
89 //
90 // </synopsis>
91 //
92 // <example>
93 // <srcblock>
94 // // Where on Earth
95 // MPosition pos(MVPosition(Quantity(20,'m'), Quantity(5,'deg'),
96 // Quantity(52,'deg')), MPosition::WGS84);
97 // // Time we want it
98 // MEpoch epo(MVEpoch(50000));
99 // // Put in frame
100 // MeasFrame frame(pos, epo);
101 // // Magnetic field model
102 // MEarthMagnetic mf;
103 // // Show field strength in Gauss in AzEl system
104 // cout <<
105 // MEarthMagnetic::Convert(mf, MEarthMagnetic::AZEL)().
106 // getValue().getLength("G") << endl;
107 // </srcblock>
108 // </example>
109 //
110 // <motivation>
111 // To have the Earth' magnetic field in the standard Measure environment.
112 // </motivation>
113 //
114 // <todo asof="2000/06/15">
115 // <li> maybe add other field models if necessary (e.g. dipole)
116 // </todo>
117 
118 class MEarthMagnetic : public MeasBase<MVEarthMagnetic, MeasRef<MEarthMagnetic> > {
119 
120  public:
121  //# Friends
122  // Conversion of data
123  friend class MeasConvert<MEarthMagnetic>;
124 
125  //# Enumerations
126  // Types of known MEarthMagnetics
127  // <note role=tip> The order defines the order in the translation matrix
128  // FromTo
129  // in the getConvert routine in MCEarthMagnetic. Do not change the order
130  // without changing the array. Additions should be made before N_types, and
131  // an additional row and column should be coded in FromTo, and
132  // in showType().</note>
133  enum Types {
156  // Models. First one should be IGRF
157  IGRF = 32,
159  // All extra bits (for internal use only)
160  EXTRA = 32,
161  // Defaults
163  // Synonyms
166  };
167 
168  //# Typedefs
169  // Measure value container for this class (i.e. MEarthMagnetic::MVType)
171  // Measure conversion routines for this class (i.e. MEarthMagnetic::MCType)
173  // Measure reference (i.e. MEarthMagnetic::Ref)
175  // Measure Convert (i.e. MEarthMagnetic::Convert)
177  // Measure table Columns (e.g., MEarthMagnetic::ScalarColumn)
180 
181  //# Constructors
182  // <note> In the following constructors and other functions, all
183  // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
184  // where no offsets or frames are needed in the reference. </note>
185  // Default constructor; generates the default IGRF type
187  // Create from data and reference
188  // <group>
195  // </group>
196 
197  // <group>
200  // </group>
201 
202  //# Destructor
203  virtual ~MEarthMagnetic();
204 
205  //# Operators
206 
207  //# General Member Functions
208  // Tell me your type
209  // <group>
210  virtual const String &tellMe() const;
211  static const String &showMe();
212  virtual uInt type() const;
213  static void assure(const Measure &in);
214  // </group>
215  // Translate reference code. The uInt version has a check for valid codes
216  // (i.e. it is a safe cast).
217  // <thrown>
218  // <li> AipsError in the uInt interface if illegal code given
219  // </thrown>
220  // <group>
223  static const String &showType(uInt tp);
224  // </group>
225  // Translate string to reference code
226  // <group>
227  static Bool getType(MEarthMagnetic::Types &tp, const String &in);
229  // </group>
230  // Set the offset in the reference (False if non-matching Measure)
231  virtual Bool setOffset(const Measure &in);
232  // Set the reference type to the specified String. False if illegal
233  // string, reference set to DEFAULT.
234  virtual Bool setRefString(const String &in);
235  // Get the default reference type
236  virtual const String &getDefaultType() const;
237  // Get a list of all known reference codes. nall returns the number in list,
238  // nextra the number of specials (like planets) that should be at
239  // end of list). typ returns the list of corresponding types.
240  // <group>
241  virtual const String* allTypes(Int &nall, Int &nextra,
242  const uInt *&typ) const;
243  static const String* allMyTypes(Int &nall, Int &nextra,
244  const uInt *&typ);
245  // </group>
246  // Check if all internal tables of types (both enum and String) are
247  // complete and correct. This function is called automatically if and when
248  // necessary.
249  // <thrown>
250  // <li> AipsError if a (programming) error in the types.
251  // </thrown>
252  // <group>
253  virtual void checkTypes() const;
254  static void checkMyTypes();
255  // </group>
256  // Get the reference type (for records, including codes like R_)
257  virtual String getRefString() const;
258  // Get my type (as Register)
259  static uInt myType();
260  // Tell me if you are a pure model (e.g. a planet)
261  virtual Bool isModel() const;
262 
263  // Get Measure data
264  // <group>
265  Quantum<Vector<Double> > get(const Unit &inunit) const;
267  Quantum<Vector<Double> > getAngle(const Unit &inunit) const;
268  // </group>
269 
270  // Make copy
271  virtual Measure *clone() const;
272 
273  private:
274  //# Enumerations
275 
276  //# Data
277 
278  //# Member functions
279 
280 };
281 
282 
283 } //# NAMESPACE CASACORE - END
284 
285 #endif
casacore::MEarthMagnetic::N_Models
@ N_Models
Definition: MEarthMagnetic.h:158
casacore::MEarthMagnetic::getAngle
Quantum< Vector< Double > > getAngle(const Unit &inunit) const
casacore::MEarthMagnetic::Ref
MeasRef< MEarthMagnetic > Ref
Measure reference (i.e.
Definition: MEarthMagnetic.h:174
casacore::MEarthMagnetic::getDefaultType
virtual const String & getDefaultType() const
Get the default reference type.
casacore::MEarthMagnetic::BMEAN
@ BMEAN
Definition: MEarthMagnetic.h:139
casacore::MEarthMagnetic::MCType
MCEarthMagnetic MCType
Measure conversion routines for this class (i.e.
Definition: MEarthMagnetic.h:172
casacore::MEarthMagnetic::setRefString
virtual Bool setRefString(const String &in)
Set the reference type to the specified String.
casacore::MEarthMagnetic::MEarthMagnetic
MEarthMagnetic(const MVEarthMagnetic &dt, MEarthMagnetic::Types rf)
casacore::MEarthMagnetic::getRefString
virtual String getRefString() const
Get the reference type (for records, including codes like R_)
casacore::MEarthMagnetic::DEFAULT
@ DEFAULT
Defaults.
Definition: MEarthMagnetic.h:162
casacore::MEarthMagnetic::showType
static const String & showType(uInt tp)
casacore::MEarthMagnetic::get
Quantum< Vector< Double > > get(const Unit &inunit) const
Get Measure data.
casacore::MEarthMagnetic::myType
static uInt myType()
Get my type (as Register)
casacore::MEarthMagnetic::MECLIPTIC
@ MECLIPTIC
Definition: MEarthMagnetic.h:149
casacore::MEarthMagnetic::Convert
MeasConvert< MEarthMagnetic > Convert
Measure Convert (i.e.
Definition: MEarthMagnetic.h:176
casacore::Measure
Physical quantities within reference frame.
Definition: Measure.h:235
casacore::MEarthMagnetic::MEarthMagnetic
MEarthMagnetic(const MEarthMagnetic::Ref &rf)
casacore::MEarthMagnetic::APP
@ APP
Definition: MEarthMagnetic.h:137
casacore::MEarthMagnetic::MEarthMagnetic
MEarthMagnetic(const MVEarthMagnetic &dt, const MEarthMagnetic::Ref &rf)
casacore::MEarthMagnetic::JNAT
@ JNAT
Definition: MEarthMagnetic.h:147
casacore::MEarthMagnetic::giveMe
Bool giveMe(MEarthMagnetic::Ref &mr, const String &in)
casacore::MEarthMagnetic::IGRF
@ IGRF
Models.
Definition: MEarthMagnetic.h:157
casacore::MEarthMagnetic::allTypes
virtual const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
casacore::MeasValue
Base class for values in a Measure.
Definition: MeasValue.h:107
casacore::MCEarthMagnetic
MEarthMagnetic conversion routines
Definition: MCEarthMagnetic.h:86
casacore::MEarthMagnetic::AZELNEGEO
@ AZELNEGEO
Definition: MEarthMagnetic.h:165
casacore::MEarthMagnetic::JMEAN
@ JMEAN
Definition: MEarthMagnetic.h:135
casacore::MEarthMagnetic::Types
Types
Types of known MEarthMagnetics Tip: The order defines the order in the translation matrix FromTo in ...
Definition: MEarthMagnetic.h:133
casacore::MEarthMagnetic::GALACTIC
@ GALACTIC
Definition: MEarthMagnetic.h:141
casacore::MVEarthMagnetic
A 3D Earth magnetic field vector.
Definition: MVEarthMagnetic.h:109
casacore::MEarthMagnetic::AZELNE
@ AZELNE
Synonyms.
Definition: MEarthMagnetic.h:164
casacore::MEarthMagnetic::HADEC
@ HADEC
Definition: MEarthMagnetic.h:142
casacore::MEarthMagnetic::TOPO
@ TOPO
Definition: MEarthMagnetic.h:153
casacore::ArrayMeasColumn
Read only access to table array Measure columns.
Definition: MBaseline.h:45
casacore::uInt
unsigned int uInt
Definition: aipstype.h:51
casacore::MEarthMagnetic::SUPERGAL
@ SUPERGAL
Definition: MEarthMagnetic.h:151
casacore::MEarthMagnetic::AZELSW
@ AZELSW
Definition: MEarthMagnetic.h:144
casacore::MEarthMagnetic::EXTRA
@ EXTRA
All extra bits (for internal use only)
Definition: MEarthMagnetic.h:160
casacore::MeasConvert
Conversion of Measures.
Definition: MBaseline.h:44
casacore::MEarthMagnetic::showType
static const String & showType(MEarthMagnetic::Types tp)
casacore::MEarthMagnetic::ICRS
@ ICRS
Definition: MEarthMagnetic.h:154
casacore::MEarthMagnetic::checkTypes
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
casacore::Int
int Int
Definition: aipstype.h:50
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::MEarthMagnetic::AZELSWGEO
@ AZELSWGEO
Definition: MEarthMagnetic.h:146
casacore::MEarthMagnetic::clone
virtual Measure * clone() const
Make copy.
casacore::MEarthMagnetic::allMyTypes
static const String * allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
casacore::MEarthMagnetic::MEarthMagnetic
MEarthMagnetic(const Measure *dt)
casacore::MEarthMagnetic::JTRUE
@ JTRUE
Definition: MEarthMagnetic.h:136
casacore::MEarthMagnetic::setOffset
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure)
casacore::MEarthMagnetic::BTRUE
@ BTRUE
Definition: MEarthMagnetic.h:140
casacore::MEarthMagnetic::ECLIPTIC
@ ECLIPTIC
Definition: MEarthMagnetic.h:148
casacore::MEarthMagnetic::MVType
MVEarthMagnetic MVType
Measure value container for this class (i.e.
Definition: MEarthMagnetic.h:170
casacore::MEarthMagnetic::castType
static MEarthMagnetic::Types castType(uInt tp)
Translate reference code.
casacore::MEarthMagnetic::MEarthMagnetic
MEarthMagnetic()
Note: In the following constructors and other functions, all MeasRef can be replaced with simple Meas...
casacore::MEarthMagnetic::~MEarthMagnetic
virtual ~MEarthMagnetic()
casacore::MEarthMagnetic::TECLIPTIC
@ TECLIPTIC
Definition: MEarthMagnetic.h:150
casacore::MEarthMagnetic::J2000
@ J2000
Definition: MEarthMagnetic.h:134
casacore::MeasBase
Base class for all measures.
Definition: MeasBase.h:75
casacore::MEarthMagnetic::AZEL
@ AZEL
Definition: MEarthMagnetic.h:143
casacore::MEarthMagnetic::tellMe
virtual const String & tellMe() const
Tell me your type.
casacore::MEarthMagnetic::ArrayColumn
ArrayMeasColumn< MEarthMagnetic > ArrayColumn
Definition: MEarthMagnetic.h:179
casacore::String
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::MEarthMagnetic::showMe
static const String & showMe()
casacore::MEarthMagnetic::getAngle
Quantum< Vector< Double > > getAngle() const
casacore::MEarthMagnetic::N_Types
@ N_Types
Definition: MEarthMagnetic.h:155
casacore::ScalarMeasColumn
Read only access to table scalar Measure columns.
Definition: MBaseline.h:46
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::MEarthMagnetic::B1950
@ B1950
Definition: MEarthMagnetic.h:138
casacore::MEarthMagnetic::MEarthMagnetic
MEarthMagnetic(const MeasValue *dt)
casacore::MEarthMagnetic::assure
static void assure(const Measure &in)
casacore::MEarthMagnetic::AZELGEO
@ AZELGEO
Definition: MEarthMagnetic.h:145
casacore::Unit
defines physical units
Definition: Unit.h:189
casacore::MEarthMagnetic::checkMyTypes
static void checkMyTypes()
casacore::MeasRef< MEarthMagnetic >
casacore::MEarthMagnetic::getType
static Bool getType(MEarthMagnetic::Types &tp, const String &in)
Translate string to reference code.
casacore::MEarthMagnetic::ScalarColumn
ScalarMeasColumn< MEarthMagnetic > ScalarColumn
Measure table Columns (e.g., MEarthMagnetic::ScalarColumn)
Definition: MEarthMagnetic.h:178
casacore::MEarthMagnetic::ITRF
@ ITRF
Definition: MEarthMagnetic.h:152
casacore::MEarthMagnetic::isModel
virtual Bool isModel() const
Tell me if you are a pure model (e.g.
casacore::Quantum
Quantities (i.e. dimensioned values)
Definition: MeasValue.h:40
casacore::MEarthMagnetic::operator=
MEarthMagnetic & operator=(const MEarthMagnetic &)
casacore::MEarthMagnetic::MEarthMagnetic
MEarthMagnetic(const MEarthMagnetic &)
casacore::MEarthMagnetic
A Measure: Magnetic field on Earth.
Definition: MEarthMagnetic.h:118
casacore::MEarthMagnetic::type
virtual uInt type() const
Get the type (== Register() of derived Measure (faster than Strings) All should have: static uInt myT...
casacore::MEarthMagnetic::MEarthMagnetic
MEarthMagnetic(const MVEarthMagnetic &dt)
Create from data and reference.