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
38// <summary> A 3D Earth magnetic field vector </summary>
39
40// <use visibility=local>
41
42// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
43// </reviewed>
44
45// <prerequisite>
46// <li> <linkto class=MeasValue>MeasValue</linkto>
47// <li> <linkto class=Vector>Vector</linkto>
48// <li> <linkto class=Quantum>Quantum</linkto>
49// </prerequisite>
50//
51// <etymology>
52// From Measure, Value and Earth Magnetic field
53// </etymology>
54//
55// <synopsis>
56// A MVEarthMagnetic is a 3-vector of the Earth's magnetic flux density in a
57// rectangular frame with the z-axis to astronomical North pole, and x-axis
58// towards longitude zero, in internal Units of nano tesla (== 0.00001 G).<br>
59// It can be constructed with:
60// <ul>
61// <li> MVEarthMagnetic() creates (0,0,0)
62// <li> MVEarthMagnetic(MVEarthMagnetic) creates a copy
63// <li> MVEarthMagnetic(MVPosition) creates (x,y,z) from the given position
64// <li> MVEarthMagnetic(Double, Double, Double) creates (x,y,z) with
65// specified values in tesla
66// <li> MVEarthMagnetic(Quantity length,Double, Double) creates an
67// MVEarthMagnetic assuming
68// that the two values are (in radians) angle along 'equator'
69// and towards 'pole'.
70// <li> MVEarthMagnetic(Quantity length, Quantity, Quantity) creates an
71// MVEarthMagnetic
72// assuming angles as in previous, or (x,y,z) fields
73// <li> <src>MVEarthMagnetic(Quantity, Quantum<Vector<Double> >)</src> creates a
74// MVEarthMagnetic from angle vector, using first two angles, and
75// assuming second as zero if not present, and pole if length 0.
76// <li> <src>MVEarthMagnetic(Quantum<Vector<Double> ></src> creates from
77// angles or fields, depending on the units in the
78// quantum vector. In the angle case,
79// the data derived can be scaled with the readjust() function. If
80// the unit of the quantum vector is magnetic flux density,
81// magnetic field components are assumed.
82// <li> <src>MVEarthMagnetic(Vector<Double></src> creates from angles (less than
83// or equal to two elements) or x,y,z (3 elements).
84// <li> <src>MVEarthMagnetic(Vector<Quantity></src> creates from length+angles,
85// angles, or x,y,z, depending on units.
86// </ul>
87// A void adjust(Double) function normalises the vector to a length of 1;
88// a get() returns as a
89// Double 3-vector the length and angles of the EarthMagnetic vector;
90// a getAngle() returns a Quantum 2-vector, (uInt) returns the indicated
91// element, and getValue returns the vector.<br>
92// EarthMagnetics can be added and subtracted.<br>
93// The multiplication of two EarthMagnetics produces the in-product.<br>
94// </synopsis>
95//
96// <example>
97// See <linkto class=MEarthMagnetic>MEarthMagnetic</linkto> class.
98// </example>
99//
100// <motivation>
101// To use in ionospheric effect calculations
102// </motivation>
103//
104// <todo asof="1998/05/19">
105// <li> nothing I know of
106// </todo>
107
109
110public:
111
112 //# Friends
113
114 //# Constructors
115 // Default constructor generates a (0,0,0) EarthMagnetic
117 // Creates from an MVPosition
119 // Creates a specified vector
121 // Creates a vector with specified length towards pole
122 // <group>
123 explicit MVEarthMagnetic(Double in0);
125 // </group>
126 // Creates the EarthMagnetic from specified (azimuth,elevation) angles and length
127 MVEarthMagnetic(const Quantity &l, Double angle0, Double angle1);
128 // Creates the EarthMagnetic from specified angles and length. or EarthMagnetics
129 // <thrown>
130 // <li> AipsError if quantities not in angle format
131 // </thrown>
132 // <group>
133 MVEarthMagnetic(const Quantity &l, const Quantity &angle0,
134 const Quantity &angle1);
135 // If not enough angles: pole assumed (if none), or elevation =0 (if 1)
138 // </group>
139 // Create from specified length and/or angles and/or EarthMagnetic
140 // <group>
143 // </group>
144
145 //# Operators
146 // Multiplication defined as in-product
147 // <group>
148 Double operator*(const MVEarthMagnetic &other) const;
149 // </group>
150
151 // Equality comparisons
152 // <group>
153 Bool operator== (const MVEarthMagnetic &other) const;
154 Bool operator!= (const MVEarthMagnetic &other) const;
155 Bool near(const MVEarthMagnetic &other, Double tol=1e-13) const;
156 Bool near(const MVEarthMagnetic &other, Quantity tol) const;
157 Bool nearAbs(const MVEarthMagnetic &other, Double tol=1e-13) const;
158 // </group>
159
160 // Addition and subtraction
161 // <group>
167 // </group>
168
169 //# General Member Functions
170
171 // Tell me your type
172 // <group>
173 static void assure(const MeasValue &in);
174 // </group>
175
176 // Normalise direction aspects by adjusting the length to 1
177 // <group>
178 virtual void adjust();
179 virtual void adjust(Double &res);
180 virtual void readjust(Double res);
181 // </group>
182 // Get modulus of EarthMagnetic
183 virtual Double radius();
184 // Generate a 3-vector of coordinates (length(T), angles(rad))
186 // Generate a 3-vector of x,y,z in tesla
187 const Vector<Double> &getValue() const;
188 // Generate angle 2-vector (in rad)
190 // and with specified units
192 // Generate the length
194 // and generate it with the specified units
195 Quantity getLength(const Unit &unit) const;
196 // Get the EarthMagnetic angle between the directions. I.e. the angle between
197 // the direction from one to the pole, and from one to the other.
198 // <group>
201 const Unit &unit) const;
202 // </group>
203 // Get the angular separation between two directions.
204 // <group>
205 Double separation(const MVEarthMagnetic &other) const;
207 const Unit &unit) const;
208 // </group>
209 // Produce the cross product
211
212 // Print data
213 virtual void print(ostream &os) const;
214 // Clone
215 virtual MeasValue *clone() const;
216 // Get the value in internal units
217 virtual Vector<Double> getVector() const;
218 // Set the value from internal units (set 0 for empty vector)
219 virtual void putVector(const Vector<Double> &in);
220 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
221 // records. The getXRecordValue() gets additional information for records.
222 // Note that the Vectors could be empty.
223 // <group>
225 // </group>
226 // Set the internal value if correct values and dimensions
227 virtual Bool putValue(const Vector<Quantum<Double> > &in);
228
229};
230
231//# Global functions
232// Rotate a EarthMagnetic vector with rotation matrix and other multiplications
233// <group>
240Double operator*(const MVPosition &left, const MVEarthMagnetic &right);
241Double operator*(const MVEarthMagnetic &left, const MVPosition &right);
242// </group>
243
244
245} //# NAMESPACE CASACORE - END
246
247#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.
this file contains all the compiler specific defines
Definition mainpage.dox:28
MVBaseline operator*(const RotMatrix &left, const MVBaseline &right)
Rotate a Baseline vector with rotation matrix and other multiplications.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53