casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
34 
35 namespace 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(Double, Double, Double) creates (x,y,z) with
66 // specified values in tesla
67 // <li> MVEarthMagnetic(Quantity length,Double, Double) creates an
68 // MVEarthMagnetic assuming
69 // that the two values are (in radians) angle along 'equator'
70 // and towards 'pole'.
71 // <li> MVEarthMagnetic(Quantity length, Quantity, Quantity) creates an
72 // MVEarthMagnetic
73 // assuming angles as in previous, or (x,y,z) fields
74 // <li> <src>MVEarthMagnetic(Quantity, Quantum<Vector<Double> >)</src> creates a
75 // MVEarthMagnetic from angle vector, using first two angles, and
76 // assuming second as zero if not present, and pole if length 0.
77 // <li> <src>MVEarthMagnetic(Quantum<Vector<Double> ></src> creates from
78 // angles or fields, depending on the units in the
79 // quantum vector. In the angle case,
80 // the data derived can be scaled with the readjust() function. If
81 // the unit of the quantum vector is magnetic flux density,
82 // magnetic field components are assumed.
83 // <li> <src>MVEarthMagnetic(Vector<Double></src> creates from angles (less than
84 // or equal to two elements) or x,y,z (3 elements).
85 // <li> <src>MVEarthMagnetic(Vector<Quantity></src> creates from length+angles,
86 // angles, or x,y,z, depending on units.
87 // </ul>
88 // A void adjust(Double) function normalises the vector to a length of 1;
89 // a get() returns as a
90 // Double 3-vector the length and angles of the EarthMagnetic vector;
91 // a getAngle() returns a Quantum 2-vector, (uInt) returns the indicated
92 // element, and getValue returns the vector.<br>
93 // EarthMagnetics can be added and subtracted.<br>
94 // The multiplication of two EarthMagnetics produces the in-product.<br>
95 // </synopsis>
96 //
97 // <example>
98 // See <linkto class=MEarthMagnetic>MEarthMagnetic</linkto> class.
99 // </example>
100 //
101 // <motivation>
102 // To use in ionospheric effect calculations
103 // </motivation>
104 //
105 // <todo asof="1998/05/19">
106 // <li> nothing I know of
107 // </todo>
108 
109 class MVEarthMagnetic : public MVPosition {
110 
111 public:
112 
113  //# Friends
114 
115  //# Constructors
116  // Default constructor generates a (0,0,0) EarthMagnetic
117  MVEarthMagnetic();
118  // Copy constructor
119  MVEarthMagnetic(const MVPosition &other);
120  // Creates a specified vector
121  MVEarthMagnetic(Double in0, Double in1, Double in2);
122  // Creates a vector with specified length towards pole
123  // <group>
124  explicit MVEarthMagnetic(Double in0);
125  MVEarthMagnetic(const Quantity &l);
126  // </group>
127  // Creates the EarthMagnetic from specified (azimuth,elevation) angles and length
128  MVEarthMagnetic(const Quantity &l, Double angle0, Double angle1);
129  // Creates the EarthMagnetic from specified angles and length. or EarthMagnetics
130  // <thrown>
131  // <li> AipsError if quantities not in angle format
132  // </thrown>
133  // <group>
134  MVEarthMagnetic(const Quantity &l, const Quantity &angle0,
135  const Quantity &angle1);
136  // If not enough angles: pole assumed (if none), or elevation =0 (if 1)
137  MVEarthMagnetic(const Quantum<Vector<Double> > &angle);
138  MVEarthMagnetic(const Quantity &l, const Quantum<Vector<Double> > &angle);
139  // </group>
140  // Create from specified length and/or angles and/or EarthMagnetic
141  // <group>
142  MVEarthMagnetic(const Vector<Double> &other);
143  MVEarthMagnetic(const Vector<Quantity> &other);
144  // </group>
145  // Copy assignment
147 
148  // Destructor
150 
151  //# Operators
152  // Multiplication defined as in-product
153  // <group>
154  Double operator*(const MVEarthMagnetic &other) const;
155  // </group>
156 
157  // Equality comparisons
158  // <group>
159  Bool operator== (const MVEarthMagnetic &other) const;
160  Bool operator!= (const MVEarthMagnetic &other) const;
161  Bool near(const MVEarthMagnetic &other, Double tol=1e-13) const;
162  Bool near(const MVEarthMagnetic &other, Quantity tol) const;
163  Bool nearAbs(const MVEarthMagnetic &other, Double tol=1e-13) const;
164  // </group>
165 
166  // Addition and subtraction
167  // <group>
168  MVEarthMagnetic operator-() const;
170  MVEarthMagnetic operator+(const MVEarthMagnetic &right) const;
172  MVEarthMagnetic operator-(const MVEarthMagnetic &right) const;
173  // </group>
174 
175  //# General Member Functions
176 
177  // Tell me your type
178  // <group>
179  virtual uInt type() const;
180  static void assure(const MeasValue &in);
181  // </group>
182 
183  // Normalise direction aspects by adjusting the length to 1
184  // <group>
185  virtual void adjust();
186  virtual void adjust(Double &res);
187  virtual void readjust(Double res);
188  // </group>
189  // Get modulus of EarthMagnetic
190  virtual Double radius();
191  // Generate a 3-vector of coordinates (length(T), angles(rad))
192  Vector<Double> get() const;
193  // Generate a 3-vector of x,y,z in tesla
194  const Vector<Double> &getValue() const;
195  // Generate angle 2-vector (in rad)
197  // and with specified units
198  Quantum<Vector<Double> > getAngle(const Unit &unit) const;
199  // Generate the length
200  Quantity getLength() const;
201  // and generate it with the specified units
202  Quantity getLength(const Unit &unit) const;
203  // Get the EarthMagnetic angle between the directions. I.e. the angle between
204  // the direction from one to the pole, and from one to the other.
205  // <group>
206  Double earthMagneticAngle(const MVEarthMagnetic &other) const;
208  const Unit &unit) const;
209  // </group>
210  // Get the angular separation between two directions.
211  // <group>
212  Double separation(const MVEarthMagnetic &other) const;
213  Quantity separation(const MVEarthMagnetic &other,
214  const Unit &unit) const;
215  // </group>
216  // Produce the cross product
217  MVEarthMagnetic crossProduct(const MVEarthMagnetic &other) const;
218 
219  // Print data
220  virtual void print(ostream &os) const;
221  // Clone
222  virtual MeasValue *clone() const;
223  // Get the value in internal units
224  virtual Vector<Double> getVector() const;
225  // Set the value from internal units (set 0 for empty vector)
226  virtual void putVector(const Vector<Double> &in);
227  // Get the internal value as a <src>Vector<Quantity></src>. Usable in
228  // records. The getXRecordValue() gets additional information for records.
229  // Note that the Vectors could be empty.
230  // <group>
231  virtual Vector<Quantum<Double> > getRecordValue() const;
232  // </group>
233  // Set the internal value if correct values and dimensions
234  virtual Bool putValue(const Vector<Quantum<Double> > &in);
235 
236 };
237 
238 //# Global functions
239 // Rotate a EarthMagnetic vector with rotation matrix and other multiplications
240 // <group>
241 MVEarthMagnetic operator*(const RotMatrix &left, const MVEarthMagnetic &right);
242 MVEarthMagnetic operator*(const MVEarthMagnetic &left, const RotMatrix &right);
243 MVEarthMagnetic operator*(Double left, const MVEarthMagnetic &right);
244 MVEarthMagnetic operator*(const MVEarthMagnetic &left, Double right);
245 Double operator*(const Vector<Double> &left, const MVEarthMagnetic &right);
246 Double operator*(const MVEarthMagnetic &left, const Vector<Double> &right);
247 Double operator*(const MVPosition &left, const MVEarthMagnetic &right);
248 Double operator*(const MVEarthMagnetic &left, const MVPosition &right);
249 // </group>
250 
251 
252 } //# NAMESPACE CASACORE - END
253 
254 #endif
virtual void print(ostream &os) const
Print data.
MVEarthMagnetic operator-() const
Addition and subtraction.
virtual Bool putValue(const Vector< Quantum< Double > > &in)
Set the internal value if correct values and dimensions.
Double earthMagneticAngle(const MVEarthMagnetic &other) const
Get the EarthMagnetic angle between the directions.
virtual MeasValue * clone() const
Clone.
Bool operator!=(const MVEarthMagnetic &other) const
static void assure(const MeasValue &in)
A 3x3 rotation matrix.
Definition: RotMatrix.h:85
const Vector< Double > & getValue() const
Generate a 3-vector of x,y,z in tesla.
MVEarthMagnetic operator*(const RotMatrix &left, const MVEarthMagnetic &right)
Rotate a EarthMagnetic vector with rotation matrix and other multiplications.
virtual uInt type() const
Tell me your type.
Bool nearAbs(const MVEarthMagnetic &other, Double tol=1e-13) const
defines physical units
Definition: Unit.h:189
MVEarthMagnetic crossProduct(const MVEarthMagnetic &other) const
Produce the cross product.
MVEarthMagnetic operator+(const MVEarthMagnetic &right) const
Base class for values in a Measure.
Definition: MeasValue.h:107
Quantity getLength() const
Generate the length.
MVEarthMagnetic & operator+=(const MVEarthMagnetic &right)
virtual void adjust()
Normalise direction aspects by adjusting the length to 1.
double Double
Definition: aipstype.h:55
MVEarthMagnetic & operator-=(const MVEarthMagnetic &right)
A 3D Earth magnetic field vector.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A 3D vector in space.
Definition: MVPosition.h:113
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector)
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector&lt;Quantity&gt;.
Double separation(const MVEarthMagnetic &other) const
Get the angular separation between two directions.
Bool near(const MVEarthMagnetic &other, Double tol=1e-13) const
Quantum< Vector< Double > > getAngle() const
Generate angle 2-vector (in rad)
virtual Vector< Double > getVector() const
Get the value in internal units.
MVEarthMagnetic & operator=(const MVEarthMagnetic &other)
Copy assignment.
const Double e
e and functions thereof:
Bool operator==(const MVEarthMagnetic &other) const
Equality comparisons.
virtual void readjust(Double res)
Re-adjust using factor given.
~MVEarthMagnetic()
Destructor.
virtual Double radius()
Get modulus of EarthMagnetic.
MVEarthMagnetic()
Default constructor generates a (0,0,0) EarthMagnetic.
unsigned int uInt
Definition: aipstype.h:51
Double operator*(const MVEarthMagnetic &other) const
Multiplication defined as in-product.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42