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