casacore
EarthMagneticMachine.h
Go to the documentation of this file.
1 //# EarthMagneticMachine.h: Calculates magnetic field in a direction
2 //# Copyright (C) 1998,2000
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 //# $Id$
27 
28 #ifndef MEASURES_EARTHMAGNETICMACHINE_H
29 #define MEASURES_EARTHMAGNETICMACHINE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/Arrays/ArrayFwd.h>
34 #include <casacore/measures/Measures.h>
35 #include <casacore/measures/Measures/MCDirection.h>
36 #include <casacore/casa/Quanta/MVPosition.h>
37 #include <casacore/measures/Measures/EarthField.h>
38 #include <casacore/casa/Quanta/MVEarthMagnetic.h>
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 //# Forward Declarations
43 class MeasFrame;
44 class MPosition;
45 class MEpoch;
46 
47 // <summary> Calculates magnetic field in a direction </summary>
48 
49 // <use visibility=export>
50 
51 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tEarthMagneticMachine.cc" demos="">
52 // </reviewed>
53 
54 // <prerequisite>
55 // <li> <linkto class=MEarthMagnetic>MEarthMagnetic</linkto> class
56 // <li> <linkto class=MDirection>MDirection</linkto> class
57 // </prerequisite>
58 //
59 // <etymology>
60 // From Earth' magnetic Field and machinery
61 // </etymology>
62 //
63 // <synopsis>
64 // The construction of an EarthMagneticMachine class object creates a
65 // machine that can
66 // calculate the magnetic field in an arbitrary direction.
67 //
68 // The constructors need a reference code (and possibly frame) input
69 // <linkto class=MDirection>MDirection::Ref</linkto> to specify how the
70 // the input coordinates have to be interpreted (e.g. MDirection::HADEC).
71 // It also needs an altitude above the Earth for which the field has to be
72 // calculated. The position on Earth can be given as either a
73 // <linkto class=MPosition>position</linkto>, or as a frame containing the
74 // position. In the latter case the frame will also be used in the
75 // coordinate transformations.
76 //
77 // Once the EarthMagneticMachine has been established, it can be used to
78 // calculate
79 // the field by the <em>calculate(MVDirection)</em> method. A variety of
80 // get methods let you obtain e.g. the field along the line of sight, the
81 // longitude of the point for which the field was calculated (e.g. the
82 // sub-ionospheric point).
83 // </synopsis>
84 //
85 // <example>
86 // <srcblock>
87 // // Define a time/position frame
88 // MEpoch epo(MVEpoch(MVTime(98,5,16,0.5).day()));
89 // MPosition pos;
90 // MeasTable::Observatory(pos, "ATCA");
91 // MeasFrame frame(epo, pos);
92 // // Note that e.g. the time in the frame can be changed later
93 // // Set up a machine
94 // EarthMagneticMachine exec(MDirection::B1950, Quantity(200, "km"), frame);
95 // // Given a current observational direction
96 // MDirection indir(Quantity(3.25745692, "rad"),
97 // Quantity(0.040643336,"rad"),
98 // MDirection::Ref(MDirection::B1950));
99 // // The field in this direction is calculated
100 // exec.calculate(indir.getValue());
101 // // Show some data
102 // cout << "Parallel field: " << exec.getLOSField() << " nT" << endl;
103 // cout << "Sub-ionosphere long: " << exec.getLong("deg") << endl;
104 // </srcblock>
105 // </example>
106 //
107 // <motivation>
108 // To aid calculating fields in a simple way.
109 // </motivation>
110 //
111 // <todo asof="1998/01/21">
112 // <li> add more get() values if necessary
113 // </todo>
114 
116 public:
117  //# Constructors
118  // Construct an empty machine (probably not usable unles set() used)
120  // Construct a machine from the input values. Either a height or direction
121  // is normally specified. The other can be set(), or can be iterated
122  // over in the () operator or the getLOSfield().
123  // <thrown>
124  // <li> AipsError if frame does not contain position and time
125  // </thrown>
126  // <group>
128  MeasFrame &frame);
130  const MPosition &pos, const MEpoch &tm);
132  MeasFrame &frame);
134  const MPosition &pos, const MEpoch &tm);
135  // </group>
136  // Copy constructor
138  // Copy assignments
140 
141  //# Destructor
143 
144  //# Operators
145  // Return line-of-sight field (nT or given units) (from previous calculate
146  // if no direction or height given)
147  // <group>
155  Quantum<Double> operator()(const Double in, const Unit &un);
156  // </group>
157 
158  //# Member functions
159  // Set or reset part of the machine
160  // <group>
161  void set(const MDirection::Ref &in);
162  void set(const Quantum<Double> &hgt);
163  void set(MeasFrame &frame);
164  void set(const MPosition &pos);
165  void set(const MEpoch &tm);
166  void set(const MVDirection &dir);
167  //</group>
168  // Calculate a value from direction or height (in m if not Quantity)
169  // <group>
172  Bool calculate(const Double hgt);
173  // </group>
174  // Return data
175  // <group>
176  // Line-of-sight field in nT
177  // <group>
182  // </group>
183  // Line-of-sight field in specified units (e.g. G)
184  // <group>
188  Quantum<Double> getLOSField(const Double in, const Unit &un);
189  // </group>
190  // Field (in nT, in ITRF)
191  // <group>
194  // </group>
195  // Longitude (rad)
196  // <group>
199  // </group>
200  // Longitude in units (e.g. deg)
201  // <group>
203  Quantum<Double> getLong(const MVDirection &in, const Unit &un);
204  // </group>
205  // Position point
206  // <group>
208  const MVPosition &getPosition(const MVDirection &in);
209  // </group>
210  // </group>
211  // Recalculate the machinery
212  void reCalculate();
213 
214 private:
215 
216  //# Data
217  // Input direction reference
219  // Height (m)
221  // Observatory position
223  // Distance to Earth centre
225  // Distance squared to sub-point
227  // Epoch
229  // Conversion engine
231  // Input position
233  // Re-typed input position
235  // Extension calculated
236  // <group>
239  // </group>
240  // Position sub-point
242  // Earth field calculator
244  // Magnetic field
246  // Line-of-sight field
248  // Field position
250  // Fields filled
252  // Cumulative filled fields
254  // Calc done
256 
257  //# Private Member Functions
258  // Initialise machinery
259  void init();
260  // Copy data members
261  void copy(const EarthMagneticMachine &other);
262  // Calculate field
263  void calculate();
264 };
265 
266 
267 } //# NAMESPACE CASACORE - END
268 
269 #endif
MVDirection in_p
Input position.
Quantum< Double > getLong(const MVDirection &in, const Unit &un)
Double getLOSField(const Double in)
EarthMagneticMachine(const MDirection::Ref &in, const Quantum< Double > &hgt, const MPosition &pos, const MEpoch &tm)
EarthMagneticMachine(const MDirection::Ref &in, const Quantum< Double > &hgt, MeasFrame &frame)
Construct a machine from the input values.
const MVEarthMagnetic & getField()
Field (in nT, in ITRF)
Double operator()(const Double in)
MVPosition sub_p
Position sub-point.
Double getLOSField(const MVDirection &in)
Quantum< Double > getLOSField(const MVDirection &in, const Unit &un)
Quantum< Double > operator()(const MVDirection &in, const Unit &un)
Bool calculate(const Double hgt)
void copy(const EarthMagneticMachine &other)
Copy data members.
Quantum< Double > operator()(const Double in, const Unit &un)
const MVEarthMagnetic & getField(const MVDirection &in)
EarthField fldc_p
Earth field calculator.
Bool fex_p
Extension calculated.
Vector< Double > pl_p
Field position.
MVPosition pos_p
Observatory position.
EarthMagneticMachine(const MDirection::Ref &in, const MVDirection &dir, const MPosition &pos, const MEpoch &tm)
EarthMagneticMachine()
Construct an empty machine (probably not usable unles set() used)
Quantum< Double > getLOSField(const Double in, const Unit &un)
const MVPosition & getPosition()
Position point.
void set(const MEpoch &tm)
Double getLOSField()
Return data.
const MVPosition & getPosition(const MVDirection &in)
Double subl_p
Distance squared to sub-point.
EarthMagneticMachine & operator=(const EarthMagneticMachine &other)
Copy assignments.
void set(const MDirection::Ref &in)
Set or reset part of the machine.
Quantum< Double > getLong(const Unit &un)
Longitude in units (e.g.
MDirection::Convert conv_p
Conversion engine.
Double getLOSField(const Quantum< Double > &in)
Double getLong()
Longitude (rad)
MVDirection rin_p
Re-typed input position.
Quantum< Double > operator()(const Unit &un)
void set(MeasFrame &frame)
MDirection::Ref inref_p
Input direction reference.
Double operator()()
Return line-of-sight field (nT or given units) (from previous calculate if no direction or height giv...
EarthMagneticMachine(const MDirection::Ref &in, const MVDirection &dir, MeasFrame &frame)
void set(const MVDirection &dir)
void calculate()
Calculate field.
void reCalculate()
Recalculate the machinery.
void set(const MPosition &pos)
Bool calculate(const MVDirection &in)
Calculate a value from direction or height (in m if not Quantity)
void set(const Quantum< Double > &hgt)
Double operator()(const Quantum< Double > &in)
Quantum< Double > getLOSField(const Quantum< Double > &in, const Unit &un)
Double los_p
Line-of-sight field.
Double getLong(const MVDirection &in)
MVEarthMagnetic fld_p
Magnetic field.
void init()
Initialise machinery.
Double operator()(const MVDirection &in)
Bool calculate(const Quantum< Double > &hgt)
Quantum< Double > getLOSField(const Unit &un)
Line-of-sight field in specified units (e.g.
Quantum< Double > operator()(const Quantum< Double > &in, const Unit &un)
Int cumf_p
Cumulative filled fields.
EarthMagneticMachine(const EarthMagneticMachine &other)
Copy constructor.
Double posl_p
Distance to Earth centre.
this file contains all the compiler specific defines
Definition: mainpage.dox:28
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
double Double
Definition: aipstype.h:55