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/measures/Measures.h>
34 #include <casacore/measures/Measures/MCDirection.h>
35 #include <casacore/casa/Quanta/MVPosition.h>
36 #include <casacore/measures/Measures/EarthField.h>
37 #include <casacore/casa/Quanta/MVEarthMagnetic.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);
133  MeasFrame &frame);
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>
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>
173  Bool calculate(const Double hgt);
174  // </group>
175  // Return data
176  // <group>
177  // Line-of-sight field in nT
178  // <group>
183  // </group>
184  // Line-of-sight field in specified units (e.g. G)
185  // <group>
189  Quantum<Double> getLOSField(const Double in, const Unit &un);
190  // </group>
191  // Field (in nT, in ITRF)
192  // <group>
195  // </group>
196  // Longitude (rad)
197  // <group>
200  // </group>
201  // Longitude in units (e.g. deg)
202  // <group>
204  Quantum<Double> getLong(const MVDirection &in, const Unit &un);
205  // </group>
206  // Position point
207  // <group>
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
casacore::EarthMagneticMachine::getLOSField
Double getLOSField()
Return data.
casacore::EarthMagneticMachine::operator()
Quantum< Double > operator()(const Unit &un)
casacore::EarthMagneticMachine::pex_p
Bool pex_p
Definition: EarthMagneticMachine.h:239
casacore::EarthMagneticMachine::getField
const MVEarthMagnetic & getField()
Field (in nT, in ITRF)
casacore::EarthMagneticMachine::operator()
Quantum< Double > operator()(const Quantum< Double > &in, const Unit &un)
casacore::EarthMagneticMachine::getLong
Double getLong()
Longitude (rad)
casacore::EarthMagneticMachine::calculate
Bool calculate(const Double hgt)
casacore::EarthMagneticMachine::EarthMagneticMachine
EarthMagneticMachine(const MDirection::Ref &in, const Quantum< Double > &hgt, MeasFrame &frame)
Construct a machine from the input values.
casacore::EarthMagneticMachine::getField
const MVEarthMagnetic & getField(const MVDirection &in)
casacore::EarthMagneticMachine::~EarthMagneticMachine
~EarthMagneticMachine()
casacore::MEpoch
A Measure: instant in time.
Definition: MEpoch.h:104
casacore::MPosition
A Measure: position on Earth.
Definition: MPosition.h:79
casacore::EarthMagneticMachine::operator()
Quantum< Double > operator()(const MVDirection &in, const Unit &un)
casacore::EarthMagneticMachine::los_p
Double los_p
Line-of-sight field.
Definition: EarthMagneticMachine.h:248
casacore::EarthMagneticMachine::calculate
void calculate()
Calculate field.
casacore::EarthMagneticMachine::fldc_p
EarthField fldc_p
Earth field calculator.
Definition: EarthMagneticMachine.h:244
casacore::EarthMagneticMachine::EarthMagneticMachine
EarthMagneticMachine(const EarthMagneticMachine &other)
Copy constructor.
casacore::EarthMagneticMachine::set
void set(const MEpoch &tm)
casacore::MVDirection
Vector of three direction cosines.
Definition: MVDirection.h:106
casacore::EarthMagneticMachine::cumf_p
Int cumf_p
Cumulative filled fields.
Definition: EarthMagneticMachine.h:254
casacore::EarthMagneticMachine::EarthMagneticMachine
EarthMagneticMachine()
Construct an empty machine (probably not usable unles set() used)
casacore::EarthMagneticMachine::pl_p
Vector< Double > pl_p
Field position.
Definition: EarthMagneticMachine.h:250
casacore::EarthMagneticMachine::operator()
Double operator()(const Double in)
casacore::EarthMagneticMachine::EarthMagneticMachine
EarthMagneticMachine(const MDirection::Ref &in, const MVDirection &dir, MeasFrame &frame)
casacore::EarthMagneticMachine::init
void init()
Initialise machinery.
casacore::EarthMagneticMachine::operator()
Quantum< Double > operator()(const Double in, const Unit &un)
casacore::EarthMagneticMachine::calculate
Bool calculate(const Quantum< Double > &hgt)
casacore::EarthMagneticMachine::getLOSField
Quantum< Double > getLOSField(const Unit &un)
Line-of-sight field in specified units (e.g.
casacore::EarthMagneticMachine::set
void set(const MDirection::Ref &in)
Set or reset part of the machine.
casacore::EarthMagneticMachine::getLOSField
Double getLOSField(const Double in)
casacore::EarthMagneticMachine::subl_p
Double subl_p
Distance squared to sub-point.
Definition: EarthMagneticMachine.h:227
casacore::EarthMagneticMachine::posl_p
Double posl_p
Distance to Earth centre.
Definition: EarthMagneticMachine.h:225
casacore::EarthMagneticMachine::pos_p
MVPosition pos_p
Observatory position.
Definition: EarthMagneticMachine.h:223
casacore::EarthMagneticMachine::operator=
EarthMagneticMachine & operator=(const EarthMagneticMachine &other)
Copy assignments.
casacore::EarthMagneticMachine::sub_p
MVPosition sub_p
Position sub-point.
Definition: EarthMagneticMachine.h:242
casacore::EarthMagneticMachine::set
void set(const MVDirection &dir)
casacore::EarthMagneticMachine::operator()
Double operator()()
Return line-of-sight field (nT or given units) (from previous calculate if no direction or height giv...
casacore::MeasFrame
Container for Measure frame.
Definition: MeasFrame.h:137
casacore::MVEarthMagnetic
A 3D Earth magnetic field vector.
Definition: MVEarthMagnetic.h:109
casacore::Double
double Double
Definition: aipstype.h:55
casacore::EarthMagneticMachine::epo_p
Double epo_p
Epoch.
Definition: EarthMagneticMachine.h:229
casacore::EarthMagneticMachine::EarthMagneticMachine
EarthMagneticMachine(const MDirection::Ref &in, const Quantum< Double > &hgt, const MPosition &pos, const MEpoch &tm)
casacore::EarthMagneticMachine::set
void set(const Quantum< Double > &hgt)
casacore::EarthField
EarthField class model calculations.
Definition: EarthField.h:130
casacore::MeasConvert< MDirection >
casacore::EarthMagneticMachine::getLOSField
Quantum< Double > getLOSField(const Double in, const Unit &un)
casacore::Int
int Int
Definition: aipstype.h:50
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::EarthMagneticMachine::getPosition
const MVPosition & getPosition()
Position point.
casacore::EarthMagneticMachine::rin_p
MVDirection rin_p
Re-typed input position.
Definition: EarthMagneticMachine.h:235
casacore::EarthMagneticMachine::fld_p
MVEarthMagnetic fld_p
Magnetic field.
Definition: EarthMagneticMachine.h:246
casacore::EarthMagneticMachine
Calculates magnetic field in a direction.
Definition: EarthMagneticMachine.h:116
casacore::EarthMagneticMachine::getLong
Double getLong(const MVDirection &in)
casacore::EarthMagneticMachine::getLong
Quantum< Double > getLong(const MVDirection &in, const Unit &un)
casacore::EarthMagneticMachine::calculate
Bool calculate(const MVDirection &in)
Calculate a value from direction or height (in m if not Quantity)
casacore::EarthMagneticMachine::fil_p
Int fil_p
Fields filled.
Definition: EarthMagneticMachine.h:252
casacore::EarthMagneticMachine::inref_p
MDirection::Ref inref_p
Input direction reference.
Definition: EarthMagneticMachine.h:219
casacore::EarthMagneticMachine::fex_p
Bool fex_p
Extension calculated.
Definition: EarthMagneticMachine.h:238
casacore::MVPosition
A 3D vector in space.
Definition: MVPosition.h:113
casacore::EarthMagneticMachine::in_p
MVDirection in_p
Input position.
Definition: EarthMagneticMachine.h:233
casacore::EarthMagneticMachine::getLOSField
Quantum< Double > getLOSField(const MVDirection &in, const Unit &un)
casacore::EarthMagneticMachine::conv_p
MDirection::Convert conv_p
Conversion engine.
Definition: EarthMagneticMachine.h:231
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::EarthMagneticMachine::operator()
Double operator()(const Quantum< Double > &in)
casacore::EarthMagneticMachine::operator()
Double operator()(const MVDirection &in)
casacore::Unit
defines physical units
Definition: Unit.h:189
casacore::Vector< Double >
casacore::MeasRef< MDirection >
casacore::EarthMagneticMachine::set
void set(const MPosition &pos)
casacore::EarthMagneticMachine::getPosition
const MVPosition & getPosition(const MVDirection &in)
casacore::EarthMagneticMachine::hgt_p
Double hgt_p
Height (m)
Definition: EarthMagneticMachine.h:221
casacore::EarthMagneticMachine::set
void set(MeasFrame &frame)
casacore::EarthMagneticMachine::EarthMagneticMachine
EarthMagneticMachine(const MDirection::Ref &in, const MVDirection &dir, const MPosition &pos, const MEpoch &tm)
casacore::EarthMagneticMachine::clx_p
Bool clx_p
Calc done.
Definition: EarthMagneticMachine.h:256
casacore::EarthMagneticMachine::getLOSField
Double getLOSField(const MVDirection &in)
casacore::EarthMagneticMachine::copy
void copy(const EarthMagneticMachine &other)
Copy data members.
casacore::Quantum< Double >
casacore::EarthMagneticMachine::getLOSField
Quantum< Double > getLOSField(const Quantum< Double > &in, const Unit &un)
casacore::EarthMagneticMachine::getLOSField
Double getLOSField(const Quantum< Double > &in)
casacore::EarthMagneticMachine::reCalculate
void reCalculate()
Recalculate the machinery.
casacore::EarthMagneticMachine::getLong
Quantum< Double > getLong(const Unit &un)
Longitude in units (e.g.