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> class MeasConvert;
41template <class M> class ArrayMeasColumn;
42template <class M> class ScalarMeasColumn;
43
44//# Typedefs
45
46// <summary> A Measure: Magnetic field on Earth </summary>
47
48// <use visibility=export>
49
50// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
51// </reviewed>
52
53// <prerequisite>
54// <li> <linkto class=Measure>Measure</linkto> class
55// </prerequisite>
56//
57// <etymology>
58// Earth and Magnetic field
59// </etymology>
60//
61// <synopsis>
62// MEarthMagnetic forms derived Measure class for Earth' magnetic flux density.
63// The field can be specified as a model, or as a 3D vector (see
64// <linkto class=MVEarthMagnetic>MVEarthMagnetic</linkto>) with a specified
65// reference frame code. If a model is specified, a possibly specified
66// explicit field will be ignored, since the field will be calculated from
67// the model if a conversion is asked for.<br>
68// The class contains the following magnetic field models:
69// <ul>
70// <li> IGRF international reference field
71// </ul>
72// The reference frame type can be any of the types specified in the
73// <linkto class=MDirection>MDirection</linkto> direction types (e.g. AZEL).
74// <note role=warning>
75// The IGRF needs a Table of coefficients (at 5-year interval) </note>
76//
77// Conversion between field models is not supported (but not relevant
78// anyway with only one model supported). Conversion to an explicit direction
79// is done by the standard <linkto class=MeasConvert>MeasConvert</linkto>
80// class and rules (see example) using <em>MEarthMagnetic::Convert</em>,
81// and the reference types (e.g. MEarthMagnetic::AZEL).
82//
83// An <linkto class=EarthMagneticMachine> EarthMagneticMachine</linkto> has
84// been provided to get e.g. the field in a certain direction at a
85// certain height.
86//
87// </synopsis>
88//
89// <example>
90// <srcblock>
91// // Where on Earth
92// MPosition pos(MVPosition(Quantity(20,'m'), Quantity(5,'deg'),
93// Quantity(52,'deg')), MPosition::WGS84);
94// // Time we want it
95// MEpoch epo(MVEpoch(50000));
96// // Put in frame
97// MeasFrame frame(pos, epo);
98// // Magnetic field model
99// MEarthMagnetic mf;
100// // Show field strength in Gauss in AzEl system
101// cout <<
102// MEarthMagnetic::Convert(mf, MEarthMagnetic::AZEL)().
103// getValue().getLength("G") << endl;
104// </srcblock>
105// </example>
106//
107// <motivation>
108// To have the Earth' magnetic field in the standard Measure environment.
109// </motivation>
110//
111// <todo asof="2000/06/15">
112// <li> maybe add other field models if necessary (e.g. dipole)
113// </todo>
114
115class MEarthMagnetic : public MeasBase<MVEarthMagnetic, MeasRef<MEarthMagnetic> > {
116
117 public:
118 //# Friends
119 // Conversion of data
120 friend class MeasConvert<MEarthMagnetic>;
121
122 //# Enumerations
123 // Types of known MEarthMagnetics
124 // <note role=tip> The order defines the order in the translation matrix
125 // FromTo
126 // in the getConvert routine in MCEarthMagnetic. Do not change the order
127 // without changing the array. Additions should be made before N_types, and
128 // an additional row and column should be coded in FromTo, and
129 // in showType().</note>
164
165 //# Typedefs
166 // Measure value container for this class (i.e. MEarthMagnetic::MVType)
168 // Measure conversion routines for this class (i.e. MEarthMagnetic::MCType)
170 // Measure reference (i.e. MEarthMagnetic::Ref)
172 // Measure Convert (i.e. MEarthMagnetic::Convert)
174 // Measure table Columns (e.g., MEarthMagnetic::ScalarColumn)
177
178 //# Constructors
179 // <note> In the following constructors and other functions, all
180 // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
181 // where no offsets or frames are needed in the reference. </note>
182 // Default constructor; generates the default IGRF type
184 // Create from data and reference
185 // <group>
192 // </group>
193
194 // <group>
197 // </group>
198
199 //# Destructor
201
202 //# Operators
203
204 //# General Member Functions
205 // Tell me your type
206 // <group>
207 virtual const String &tellMe() const;
208 static const String &showMe();
209 static void assure(const Measure &in);
210 // </group>
211 // Translate reference code. The uInt version has a check for valid codes
212 // (i.e. it is a safe cast).
213 // <thrown>
214 // <li> AipsError in the uInt interface if illegal code given
215 // </thrown>
216 // <group>
219 static const String &showType(uInt tp);
220 // </group>
221 // Translate string to reference code
222 // <group>
223 static Bool getType(MEarthMagnetic::Types &tp, const String &in);
225 // </group>
226 // Set the offset in the reference (False if non-matching Measure)
227 virtual Bool setOffset(const Measure &in);
228 // Set the reference type to the specified String. False if illegal
229 // string, reference set to DEFAULT.
230 virtual Bool setRefString(const String &in);
231 // Get the default reference type
232 virtual const String &getDefaultType() const;
233 // Get a list of all known reference codes. nall returns the number in list,
234 // nextra the number of specials (like planets) that should be at
235 // end of list). typ returns the list of corresponding types.
236 // <group>
237 virtual const String* allTypes(Int &nall, Int &nextra,
238 const uInt *&typ) const;
239 static const String* allMyTypes(Int &nall, Int &nextra,
240 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
276
277} //# NAMESPACE CASACORE - END
278
279#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:223
this file contains all the compiler specific defines
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