casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
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
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
186  MEarthMagnetic();
187  // Create from data and reference
188  // <group>
189  MEarthMagnetic(const MVEarthMagnetic &dt);
190  MEarthMagnetic(const MVEarthMagnetic &dt, const MEarthMagnetic::Ref &rf);
192  MEarthMagnetic(const Measure *dt);
193  MEarthMagnetic(const MeasValue *dt);
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>
222  static const String &showType(MEarthMagnetic::Types tp);
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);
228  Bool giveMe(MEarthMagnetic::Ref &mr, 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
virtual String getRefString() const
Get the reference type (for records, including codes like R_)
ArrayMeasColumn< MEarthMagnetic > ArrayColumn
int Int
Definition: aipstype.h:50
Conversion of Measures.
Definition: MDirection.h:43
static void assure(const Measure &in)
MEarthMagnetic()
Note: In the following constructors and other functions, all MeasRef can be replaced with simple Mea...
virtual const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
static MEarthMagnetic::Types castType(uInt tp)
Translate reference code.
static uInt myType()
Get my type (as Register)
Physical quantities within reference frame.
Definition: Measure.h:235
MeasRef< MEarthMagnetic > Ref
Measure reference (i.e.
Base class for all measures.
Definition: MeasBase.h:75
static const String & showType(MEarthMagnetic::Types tp)
All extra bits (for internal use only)
Bool giveMe(MEarthMagnetic::Ref &mr, const String &in)
ScalarMeasColumn< MEarthMagnetic > ScalarColumn
Measure table Columns (e.g., MEarthMagnetic::ScalarColumn)
defines physical units
Definition: Unit.h:189
A Measure: Magnetic field on Earth.
virtual const String & tellMe() const
Tell me your type.
Base class for values in a Measure.
Definition: MeasValue.h:107
MEarthMagnetic conversion routines.
virtual Bool setRefString(const String &in)
Set the reference type to the specified String.
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure)
MCEarthMagnetic MCType
Measure conversion routines for this class (i.e.
virtual uInt type() const
Get the type (== Register() of derived Measure (faster than Strings) All should have: static uInt myT...
static void checkMyTypes()
MeasConvert< MEarthMagnetic > Convert
Measure Convert (i.e.
A 3D Earth magnetic field vector.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Quantum< Vector< Double > > getAngle() const
virtual Measure * clone() const
Make copy.
Quantities (i.e. dimensioned values)
Definition: QuantumHolder.h:44
static const String & showMe()
virtual const String & getDefaultType() const
Get the default reference type.
static const String * allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
MVEarthMagnetic MVType
Measure value container for this class (i.e.
static Bool getType(MEarthMagnetic::Types &tp, const String &in)
Translate string to reference code.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Types
Types of known MEarthMagnetics Tip: The order defines the order in the translation matrix FromTo in ...
MEarthMagnetic & operator=(const MEarthMagnetic &)
virtual Bool isModel() const
Tell me if you are a pure model (e.g.
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42