casacore
Loading...
Searching...
No Matches
MVEarthMagnetic.h
Go to the documentation of this file.
1// # MVEarthMagnetic.h: A 3D Earth magnetic field vector
2// # Copyright (C) 1996,1997,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 CASA_MVEARTHMAGNETIC_H
27#define CASA_MVEARTHMAGNETIC_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Quanta/MVPosition.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// # Forward Declarations
36
37// <summary> A 3D Earth magnetic field vector </summary>
38
39// <use visibility=local>
40
41// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
42// </reviewed>
43
44// <prerequisite>
45// <li> <linkto class=MeasValue>MeasValue</linkto>
46// <li> <linkto class=Vector>Vector</linkto>
47// <li> <linkto class=Quantum>Quantum</linkto>
48// </prerequisite>
49//
50// <etymology>
51// From Measure, Value and Earth Magnetic field
52// </etymology>
53//
54// <synopsis>
55// A MVEarthMagnetic is a 3-vector of the Earth's magnetic flux density in a
56// rectangular frame with the z-axis to astronomical North pole, and x-axis
57// towards longitude zero, in internal Units of nano tesla (== 0.00001 G).<br>
58// It can be constructed with:
59// <ul>
60// <li> MVEarthMagnetic() creates (0,0,0)
61// <li> MVEarthMagnetic(MVEarthMagnetic) creates a copy
62// <li> MVEarthMagnetic(MVPosition) creates (x,y,z) from the given position
63// <li> MVEarthMagnetic(Double, Double, Double) creates (x,y,z) with
64// specified values in tesla
65// <li> MVEarthMagnetic(Quantity length,Double, Double) creates an
66// MVEarthMagnetic assuming
67// that the two values are (in radians) angle along 'equator'
68// and towards 'pole'.
69// <li> MVEarthMagnetic(Quantity length, Quantity, Quantity) creates an
70// MVEarthMagnetic
71// assuming angles as in previous, or (x,y,z) fields
72// <li> <src>MVEarthMagnetic(Quantity, Quantum<Vector<Double> >)</src> creates a
73// MVEarthMagnetic from angle vector, using first two angles, and
74// assuming second as zero if not present, and pole if length 0.
75// <li> <src>MVEarthMagnetic(Quantum<Vector<Double> ></src> creates from
76// angles or fields, depending on the units in the
77// quantum vector. In the angle case,
78// the data derived can be scaled with the readjust() function. If
79// the unit of the quantum vector is magnetic flux density,
80// magnetic field components are assumed.
81// <li> <src>MVEarthMagnetic(Vector<Double></src> creates from angles (less than
82// or equal to two elements) or x,y,z (3 elements).
83// <li> <src>MVEarthMagnetic(Vector<Quantity></src> creates from length+angles,
84// angles, or x,y,z, depending on units.
85// </ul>
86// A void adjust(Double) function normalises the vector to a length of 1;
87// a get() returns as a
88// Double 3-vector the length and angles of the EarthMagnetic vector;
89// a getAngle() returns a Quantum 2-vector, (uInt) returns the indicated
90// element, and getValue returns the vector.<br>
91// EarthMagnetics can be added and subtracted.<br>
92// The multiplication of two EarthMagnetics produces the in-product.<br>
93// </synopsis>
94//
95// <example>
96// See <linkto class=MEarthMagnetic>MEarthMagnetic</linkto> class.
97// </example>
98//
99// <motivation>
100// To use in ionospheric effect calculations
101// </motivation>
102//
103// <todo asof="1998/05/19">
104// <li> nothing I know of
105// </todo>
106
108 public:
109 // # Friends
110
111 // # Constructors
112 // Default constructor generates a (0,0,0) EarthMagnetic
114 // Creates from an MVPosition
116 // Creates a specified vector
118 // Creates a vector with specified length towards pole
119 // <group>
120 explicit MVEarthMagnetic(Double in0);
122 // </group>
123 // Creates the EarthMagnetic from specified (azimuth,elevation) angles and length
124 MVEarthMagnetic(const Quantity &l, Double angle0, Double angle1);
125 // Creates the EarthMagnetic from specified angles and length. or EarthMagnetics
126 // <thrown>
127 // <li> AipsError if quantities not in angle format
128 // </thrown>
129 // <group>
130 MVEarthMagnetic(const Quantity &l, const Quantity &angle0, const Quantity &angle1);
131 // If not enough angles: pole assumed (if none), or elevation =0 (if 1)
134 // </group>
135 // Create from specified length and/or angles and/or EarthMagnetic
136 // <group>
139 // </group>
140
141 // # Operators
142 // Multiplication defined as in-product
143 // <group>
144 Double operator*(const MVEarthMagnetic &other) const;
145 // </group>
146
147 // Equality comparisons
148 // <group>
149 Bool operator==(const MVEarthMagnetic &other) const;
150 Bool operator!=(const MVEarthMagnetic &other) const;
151 Bool near(const MVEarthMagnetic &other, Double tol = 1e-13) const;
152 Bool near(const MVEarthMagnetic &other, Quantity tol) const;
153 Bool nearAbs(const MVEarthMagnetic &other, Double tol = 1e-13) const;
154 // </group>
155
156 // Addition and subtraction
157 // <group>
163 // </group>
164
165 // # General Member Functions
166
167 // Tell me your type
168 // <group>
169 static void assure(const MeasValue &in);
170 // </group>
171
172 // Normalise direction aspects by adjusting the length to 1
173 // <group>
174 virtual void adjust();
175 virtual void adjust(Double &res);
176 virtual void readjust(Double res);
177 // </group>
178 // Get modulus of EarthMagnetic
179 virtual Double radius();
180 // Generate a 3-vector of coordinates (length(T), angles(rad))
182 // Generate a 3-vector of x,y,z in tesla
183 const Vector<Double> &getValue() const;
184 // Generate angle 2-vector (in rad)
186 // and with specified units
188 // Generate the length
190 // and generate it with the specified units
191 Quantity getLength(const Unit &unit) const;
192 // Get the EarthMagnetic angle between the directions. I.e. the angle between
193 // the direction from one to the pole, and from one to the other.
194 // <group>
196 Quantity earthMagneticAngle(const MVEarthMagnetic &other, const Unit &unit) const;
197 // </group>
198 // Get the angular separation between two directions.
199 // <group>
200 Double separation(const MVEarthMagnetic &other) const;
201 Quantity separation(const MVEarthMagnetic &other, const Unit &unit) const;
202 // </group>
203 // Produce the cross product
205
206 // Print data
207 virtual void print(ostream &os) const;
208 // Clone
209 virtual MeasValue *clone() const;
210 // Get the value in internal units
211 virtual Vector<Double> getVector() const;
212 // Set the value from internal units (set 0 for empty vector)
213 virtual void putVector(const Vector<Double> &in);
214 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
215 // records. The getXRecordValue() gets additional information for records.
216 // Note that the Vectors could be empty.
217 // <group>
219 // </group>
220 // Set the internal value if correct values and dimensions
221 virtual Bool putValue(const Vector<Quantum<Double>> &in);
222};
223
224// # Global functions
225// Rotate a EarthMagnetic vector with rotation matrix and other multiplications
226// <group>
233Double operator*(const MVPosition &left, const MVEarthMagnetic &right);
234Double operator*(const MVEarthMagnetic &left, const MVPosition &right);
235// </group>
236
237} // namespace casacore
238
239#endif
MVEarthMagnetic(const Quantum< Vector< Double > > &angle)
If not enough angles: pole assumed (if none), or elevation =0 (if 1).
Quantity earthMagneticAngle(const MVEarthMagnetic &other, const Unit &unit) const
virtual void readjust(Double res)
Re-adjust using factor given.
Double separation(const MVEarthMagnetic &other) const
Get the angular separation between two directions.
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector).
Bool operator==(const MVEarthMagnetic &other) const
Equality comparisons.
Double operator*(const MVEarthMagnetic &other) const
Multiplication defined as in-product.
MVEarthMagnetic()
Default constructor generates a (0,0,0) EarthMagnetic.
Double earthMagneticAngle(const MVEarthMagnetic &other) const
Get the EarthMagnetic angle between the directions.
virtual Double radius()
Get modulus of EarthMagnetic.
MVEarthMagnetic(const Quantity &l)
virtual Bool putValue(const Vector< Quantum< Double > > &in)
Set the internal value if correct values and dimensions.
Quantity getLength() const
Generate the length.
virtual Vector< Double > getVector() const
Get the value in internal units.
Quantum< Vector< Double > > getAngle(const Unit &unit) const
and with specified units
MVEarthMagnetic operator-(const MVEarthMagnetic &right) const
virtual void print(ostream &os) const
Print data.
static void assure(const MeasValue &in)
Tell me your type.
Quantity getLength(const Unit &unit) const
and generate it with the specified units
Bool nearAbs(const MVEarthMagnetic &other, Double tol=1e-13) const
MVEarthMagnetic(Double in0, Double in1, Double in2)
Creates a specified vector.
const Vector< Double > & getValue() const
Generate a 3-vector of x,y,z in tesla.
virtual MeasValue * clone() const
Clone.
virtual void adjust(Double &res)
Adjustment with returned factor.
Bool near(const MVEarthMagnetic &other, Quantity tol) const
Bool near(const MVEarthMagnetic &other, Double tol=1e-13) const
MVEarthMagnetic(const Quantity &l, const Quantity &angle0, const Quantity &angle1)
Creates the EarthMagnetic from specified angles and length.
Vector< Double > get() const
Generate a 3-vector of coordinates (length(T), angles(rad)).
MVEarthMagnetic operator+(const MVEarthMagnetic &right) const
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector<Quantity>.
Bool operator!=(const MVEarthMagnetic &other) const
MVEarthMagnetic(Double in0)
Creates a vector with specified length towards pole.
MVEarthMagnetic(const MVPosition &other)
Creates from an MVPosition.
MVEarthMagnetic & operator+=(const MVEarthMagnetic &right)
Quantity separation(const MVEarthMagnetic &other, const Unit &unit) const
MVEarthMagnetic(const Vector< Double > &other)
Create from specified length and/or angles and/or EarthMagnetic.
MVEarthMagnetic crossProduct(const MVEarthMagnetic &other) const
Produce the cross product.
MVEarthMagnetic & operator-=(const MVEarthMagnetic &right)
MVEarthMagnetic(const Vector< Quantity > &other)
MVEarthMagnetic(const Quantity &l, Double angle0, Double angle1)
Creates the EarthMagnetic from specified (azimuth,elevation) angles and length.
MVEarthMagnetic(const Quantity &l, const Quantum< Vector< Double > > &angle)
MVEarthMagnetic operator-() const
Addition and subtraction.
Quantum< Vector< Double > > getAngle() const
Generate angle 2-vector (in rad).
virtual void adjust()
Normalise direction aspects by adjusting the length to 1.
MVPosition()
Default constructor generates a (0,0,0) position.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
T & operator*()
Provide access to the field's value.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Quantum< Double > Quantity
Definition Quantum.h:40
double Double
Definition aipstype.h:53