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