casa  5.7.0-16
 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>
38 
39 namespace casacore { //# NAMESPACE CASACORE - BEGIN
40 
41 //# Forward Declarations
42 class MeasFrame;
43 class MPosition;
44 class MEpoch;
45 
46 template <class T> class Vector;
47 
48 // <summary> Calculates magnetic field in a direction </summary>
49 
50 // <use visibility=export>
51 
52 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tEarthMagneticMachine.cc" demos="">
53 // </reviewed>
54 
55 // <prerequisite>
56 // <li> <linkto class=MEarthMagnetic>MEarthMagnetic</linkto> class
57 // <li> <linkto class=MDirection>MDirection</linkto> class
58 // </prerequisite>
59 //
60 // <etymology>
61 // From Earth' magnetic Field and machinery
62 // </etymology>
63 //
64 // <synopsis>
65 // The construction of an EarthMagneticMachine class object creates a
66 // machine that can
67 // calculate the magnetic field in an arbitrary direction.
68 //
69 // The constructors need a reference code (and possibly frame) input
70 // <linkto class=MDirection>MDirection::Ref</linkto> to specify how the
71 // the input coordinates have to be interpreted (e.g. MDirection::HADEC).
72 // It also needs an altitude above the Earth for which the field has to be
73 // calculated. The position on Earth can be given as either a
74 // <linkto class=MPosition>position</linkto>, or as a frame containing the
75 // position. In the latter case the frame will also be used in the
76 // coordinate transformations.
77 //
78 // Once the EarthMagneticMachine has been established, it can be used to
79 // calculate
80 // the field by the <em>calculate(MVDirection)</em> method. A variety of
81 // get methods let you obtain e.g. the field along the line of sight, the
82 // longitude of the point for which the field was calculated (e.g. the
83 // sub-ionospheric point).
84 // </synopsis>
85 //
86 // <example>
87 // <srcblock>
88 // // Define a time/position frame
89 // MEpoch epo(MVEpoch(MVTime(98,5,16,0.5).day()));
90 // MPosition pos;
91 // MeasTable::Observatory(pos, "ATCA");
92 // MeasFrame frame(epo, pos);
93 // // Note that e.g. the time in the frame can be changed later
94 // // Set up a machine
95 // EarthMagneticMachine exec(MDirection::B1950, Quantity(200, "km"), frame);
96 // // Given a current observational direction
97 // MDirection indir(Quantity(3.25745692, "rad"),
98 // Quantity(0.040643336,"rad"),
99 // MDirection::Ref(MDirection::B1950));
100 // // The field in this direction is calculated
101 // exec.calculate(indir.getValue());
102 // // Show some data
103 // cout << "Parallel field: " << exec.getLOSField() << " nT" << endl;
104 // cout << "Sub-ionosphere long: " << exec.getLong("deg") << endl;
105 // </srcblock>
106 // </example>
107 //
108 // <motivation>
109 // To aid calculating fields in a simple way.
110 // </motivation>
111 //
112 // <todo asof="1998/01/21">
113 // <li> add more get() values if necessary
114 // </todo>
115 
117 public:
118  //# Constructors
119  // Construct an empty machine (probably not usable unles set() used)
121  // Construct a machine from the input values. Either a height or direction
122  // is normally specified. The other can be set(), or can be iterated
123  // over in the () operator or the getLOSfield().
124  // <thrown>
125  // <li> AipsError if frame does not contain position and time
126  // </thrown>
127  // <group>
129  MeasFrame &frame);
131  const MPosition &pos, const MEpoch &tm);
132  EarthMagneticMachine(const MDirection::Ref &in, const MVDirection &dir,
133  MeasFrame &frame);
134  EarthMagneticMachine(const MDirection::Ref &in, const MVDirection &dir,
135  const MPosition &pos, const MEpoch &tm);
136  // </group>
137  // Copy constructor
139  // Copy assignments
141 
142  //# Destructor
144 
145  //# Operators
146  // Return line-of-sight field (nT or given units) (from previous calculate
147  // if no direction or height given)
148  // <group>
149  Double operator()();
150  Quantum<Double> operator()(const Unit &un);
151  Double operator()(const MVDirection &in);
152  Quantum<Double> operator()(const MVDirection &in, const Unit &un);
153  Double operator()(const Quantum<Double> &in);
154  Quantum<Double> operator()(const Quantum<Double> &in, const Unit &un);
155  Double operator()(const Double in);
156  Quantum<Double> operator()(const Double in, const Unit &un);
157  // </group>
158 
159  //# Member functions
160  // Set or reset part of the machine
161  // <group>
162  void set(const MDirection::Ref &in);
163  void set(const Quantum<Double> &hgt);
164  void set(MeasFrame &frame);
165  void set(const MPosition &pos);
166  void set(const MEpoch &tm);
167  void set(const MVDirection &dir);
168  //</group>
169  // Calculate a value from direction or height (in m if not Quantity)
170  // <group>
171  Bool calculate(const MVDirection &in);
172  Bool calculate(const Quantum<Double> &hgt);
173  Bool calculate(const Double hgt);
174  // </group>
175  // Return data
176  // <group>
177  // Line-of-sight field in nT
178  // <group>
180  Double getLOSField(const MVDirection &in);
182  Double getLOSField(const Double in);
183  // </group>
184  // Line-of-sight field in specified units (e.g. G)
185  // <group>
186  Quantum<Double> getLOSField(const Unit &un);
187  Quantum<Double> getLOSField(const MVDirection &in, const Unit &un);
188  Quantum<Double> getLOSField(const Quantum<Double> &in, const Unit &un);
189  Quantum<Double> getLOSField(const Double in, const Unit &un);
190  // </group>
191  // Field (in nT, in ITRF)
192  // <group>
193  const MVEarthMagnetic &getField();
194  const MVEarthMagnetic &getField(const MVDirection &in);
195  // </group>
196  // Longitude (rad)
197  // <group>
198  Double getLong();
199  Double getLong(const MVDirection &in);
200  // </group>
201  // Longitude in units (e.g. deg)
202  // <group>
203  Quantum<Double> getLong(const Unit &un);
204  Quantum<Double> getLong(const MVDirection &in, const Unit &un);
205  // </group>
206  // Position point
207  // <group>
208  const MVPosition &getPosition();
209  const MVPosition &getPosition(const MVDirection &in);
210  // </group>
211  // </group>
212  // Recalculate the machinery
213  void reCalculate();
214 
215 private:
216 
217  //# Data
218  // Input direction reference
220  // Height (m)
222  // Observatory position
224  // Distance to Earth centre
226  // Distance squared to sub-point
228  // Epoch
230  // Conversion engine
232  // Input position
234  // Re-typed input position
236  // Extension calculated
237  // <group>
240  // </group>
241  // Position sub-point
243  // Earth field calculator
245  // Magnetic field
247  // Line-of-sight field
249  // Field position
251  // Fields filled
253  // Cumulative filled fields
255  // Calc done
257 
258  //# Private Member Functions
259  // Initialise machinery
260  void init();
261  // Copy data members
262  void copy(const EarthMagneticMachine &other);
263  // Calculate field
264  void calculate();
265 };
266 
267 
268 } //# NAMESPACE CASACORE - END
269 
270 #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
std::vector< double > Vector
Definition: ds9context.h:24
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:106
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.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42