casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef MEASURES_MEARTHMAGNETIC_H
27#define MEASURES_MEARTHMAGNETIC_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/measures/Measures/MeasBase.h>
32#include <casacore/measures/Measures/MeasRef.h>
33#include <casacore/casa/Quanta/MVEarthMagnetic.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38class MEarthMagnetic;
39class MCEarthMagnetic;
40template <class M>
41class MeasConvert;
42template <class M>
43class ArrayMeasColumn;
44template <class M>
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
118class MEarthMagnetic : public MeasBase<MVEarthMagnetic, MeasRef<MEarthMagnetic>> {
119 public:
120 // # Friends
121 // Conversion of data
122 friend class MeasConvert<MEarthMagnetic>;
123
124 // # Enumerations
125 // Types of known MEarthMagnetics
126 // <note role=tip> The order defines the order in the translation matrix
127 // FromTo
128 // in the getConvert routine in MCEarthMagnetic. Do not change the order
129 // without changing the array. Additions should be made before N_types, and
130 // an additional row and column should be coded in FromTo, and
131 // in showType().</note>
132 enum Types {
155 // Models. First one should be IGRF
156 IGRF = 32,
158 // All extra bits (for internal use only)
159 EXTRA = 32,
160 // Defaults
162 // Synonyms
165 };
166
167 // # Typedefs
168 // Measure value container for this class (i.e. MEarthMagnetic::MVType)
170 // Measure conversion routines for this class (i.e. MEarthMagnetic::MCType)
172 // Measure reference (i.e. MEarthMagnetic::Ref)
174 // Measure Convert (i.e. MEarthMagnetic::Convert)
176 // Measure table Columns (e.g., MEarthMagnetic::ScalarColumn)
179
180 // # Constructors
181 // <note> In the following constructors and other functions, all
182 // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
183 // where no offsets or frames are needed in the reference. </note>
184 // Default constructor; generates the default IGRF type
186 // Create from data and reference
187 // <group>
194 // </group>
195
196 // <group>
199 // </group>
200
201 // # Destructor
203
204 // # Operators
205
206 // # General Member Functions
207 // Tell me your type
208 // <group>
209 virtual const String &tellMe() const;
210 static const String &showMe();
211 static void assure(const Measure &in);
212 // </group>
213 // Translate reference code. The uInt version has a check for valid codes
214 // (i.e. it is a safe cast).
215 // <thrown>
216 // <li> AipsError in the uInt interface if illegal code given
217 // </thrown>
218 // <group>
221 static const String &showType(uInt tp);
222 // </group>
223 // Translate string to reference code
224 // <group>
225 static Bool getType(MEarthMagnetic::Types &tp, const String &in);
227 // </group>
228 // Set the offset in the reference (False if non-matching Measure)
229 virtual Bool setOffset(const Measure &in);
230 // Set the reference type to the specified String. False if illegal
231 // string, reference set to DEFAULT.
232 virtual Bool setRefString(const String &in);
233 // Get the default reference type
234 virtual const String &getDefaultType() const;
235 // Get a list of all known reference codes. nall returns the number in list,
236 // nextra the number of specials (like planets) that should be at
237 // end of list). typ returns the list of corresponding types.
238 // <group>
239 virtual const String *allTypes(Int &nall, Int &nextra, const uInt *&typ) const;
240 static const String *allMyTypes(Int &nall, Int &nextra, const uInt *&typ);
241 // </group>
242 // Check if all internal tables of types (both enum and String) are
243 // complete and correct. This function is called automatically if and when
244 // necessary.
245 // <thrown>
246 // <li> AipsError if a (programming) error in the types.
247 // </thrown>
248 // <group>
249 virtual void checkTypes() const;
250 static void checkMyTypes();
251 // </group>
252 // Get the reference type (for records, including codes like R_)
253 virtual String getRefString() const;
254 // Tell me if you are a pure model (e.g. a planet)
255 virtual Bool isModel() const;
256
257 // Get Measure data
258 // <group>
259 Quantum<Vector<Double>> get(const Unit &inunit) const;
261 Quantum<Vector<Double>> getAngle(const Unit &inunit) const;
262 // </group>
263
264 // Make copy
265 virtual Measure *clone() const;
266
267 private:
268 // # Enumerations
269
270 // # Data
271
272 // # Member functions
273};
274
275} // namespace casacore
276
277#endif
virtual const String & tellMe() const
Tell me your type.
static const String * allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
virtual const String & getDefaultType() const
Get the default reference type.
static const String & showType(MEarthMagnetic::Types tp)
Quantum< Vector< Double > > getAngle() const
static void checkMyTypes()
static const String & showType(uInt tp)
MCEarthMagnetic MCType
Measure conversion routines for this class (i.e.
MEarthMagnetic(const MVEarthMagnetic &dt, const MEarthMagnetic::Ref &rf)
virtual String getRefString() const
Get the reference type (for records, including codes like R_).
ArrayMeasColumn< MEarthMagnetic > ArrayColumn
MEarthMagnetic()
Note: In the following constructors and other functions, all MeasRef can be replaced with simple Meas...
MEarthMagnetic(const MeasValue *dt)
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
virtual Bool isModel() const
Tell me if you are a pure model (e.g.
MEarthMagnetic(const MVEarthMagnetic &dt, MEarthMagnetic::Types rf)
MEarthMagnetic(const MEarthMagnetic::Ref &rf)
static Bool getType(MEarthMagnetic::Types &tp, const String &in)
Translate string to reference code.
Quantum< Vector< Double > > getAngle(const Unit &inunit) const
static MEarthMagnetic::Types castType(uInt tp)
Translate reference code.
Quantum< Vector< Double > > get(const Unit &inunit) const
Get Measure data.
MVEarthMagnetic MVType
Measure value container for this class (i.e.
virtual const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
static const String & showMe()
MEarthMagnetic(const MVEarthMagnetic &dt)
Create from data and reference.
MeasConvert< MEarthMagnetic > Convert
Measure Convert (i.e.
static void assure(const Measure &in)
Bool giveMe(MEarthMagnetic::Ref &mr, const String &in)
ScalarMeasColumn< MEarthMagnetic > ScalarColumn
Measure table Columns (e.g., MEarthMagnetic::ScalarColumn).
virtual Bool setRefString(const String &in)
Set the reference type to the specified String.
virtual Measure * clone() const
Make copy.
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure).
MEarthMagnetic & operator=(const MEarthMagnetic &)
MEarthMagnetic(const Measure *dt)
MEarthMagnetic(const MEarthMagnetic &)
MeasRef< MEarthMagnetic > Ref
Measure reference (i.e.
Types
Types of known MEarthMagnetics Tip: The order defines the order in the translation matrix FromTo in ...
@ EXTRA
All extra bits (for internal use only).
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40