casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
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);
131  EarthMagneticMachine(const MDirection::Ref &in, const MVDirection &dir,
132  MeasFrame &frame);
133  EarthMagneticMachine(const MDirection::Ref &in, const MVDirection &dir,
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>
148  Double operator()();
149  Quantum<Double> operator()(const Unit &un);
150  Double operator()(const MVDirection &in);
151  Quantum<Double> operator()(const MVDirection &in, const Unit &un);
152  Double operator()(const Quantum<Double> &in);
153  Quantum<Double> operator()(const Quantum<Double> &in, const Unit &un);
154  Double operator()(const Double in);
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>
170  Bool calculate(const MVDirection &in);
171  Bool calculate(const Quantum<Double> &hgt);
172  Bool calculate(const Double hgt);
173  // </group>
174  // Return data
175  // <group>
176  // Line-of-sight field in nT
177  // <group>
179  Double getLOSField(const MVDirection &in);
181  Double getLOSField(const Double in);
182  // </group>
183  // Line-of-sight field in specified units (e.g. G)
184  // <group>
185  Quantum<Double> getLOSField(const Unit &un);
186  Quantum<Double> getLOSField(const MVDirection &in, const Unit &un);
187  Quantum<Double> getLOSField(const Quantum<Double> &in, const Unit &un);
188  Quantum<Double> getLOSField(const Double in, const Unit &un);
189  // </group>
190  // Field (in nT, in ITRF)
191  // <group>
192  const MVEarthMagnetic &getField();
193  const MVEarthMagnetic &getField(const MVDirection &in);
194  // </group>
195  // Longitude (rad)
196  // <group>
197  Double getLong();
198  Double getLong(const MVDirection &in);
199  // </group>
200  // Longitude in units (e.g. deg)
201  // <group>
202  Quantum<Double> getLong(const Unit &un);
203  Quantum<Double> getLong(const MVDirection &in, const Unit &un);
204  // </group>
205  // Position point
206  // <group>
207  const MVPosition &getPosition();
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 rin_p
Re-typed input position.
A Measure: position on Earth.
Definition: MPosition.h:79
void set(const MDirection::Ref &in)
Set or reset part of the machine.
int Int
Definition: aipstype.h:50
Double getLOSField()
Return data.
EarthField class model calculations.
Definition: EarthField.h:130
Vector< Double > pl_p
Field position.
EarthField fldc_p
Earth field calculator.
Container for Measure frame.
Definition: MeasFrame.h:137
MVEarthMagnetic fld_p
Magnetic field.
Double getLong()
Longitude (rad)
Double posl_p
Distance to Earth centre.
A Measure: instant in time.
Definition: MEpoch.h:104
void copy(const EarthMagneticMachine &other)
Copy data members.
defines physical units
Definition: Unit.h:189
Calculates magnetic field in a direction.
MVDirection in_p
Input position.
MVPosition pos_p
Observatory position.
EarthMagneticMachine()
Construct an empty machine (probably not usable unles set() used)
Double los_p
Line-of-sight field.
double Double
Definition: aipstype.h:55
void reCalculate()
Recalculate the machinery.
A 3D Earth magnetic field vector.
MDirection::Convert conv_p
Conversion engine.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A 3D vector in space.
Definition: MVPosition.h:113
EarthMagneticMachine & operator=(const EarthMagneticMachine &other)
Copy assignments.
Bool fex_p
Extension calculated.
Double operator()()
Return line-of-sight field (nT or given units) (from previous calculate if no direction or height giv...
void calculate()
Calculate field.
void init()
Initialise machinery.
MVPosition sub_p
Position sub-point.
Vector of three direction cosines.
Definition: MVDirection.h:107
MDirection::Ref inref_p
Input direction reference.
const MVPosition & getPosition()
Position point.
const MVEarthMagnetic & getField()
Field (in nT, in ITRF)
Int cumf_p
Cumulative filled fields.
Double subl_p
Distance squared to sub-point.