casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MVRadialVelocity.h
Go to the documentation of this file.
1 //# MVRadialVelocity.h: Internal value for MRadialvelocity
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2003
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_MVRADIALVELOCITY_H
29 #define CASA_MVRADIALVELOCITY_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
37 #include <casacore/casa/iosfwd.h>
38 
39 namespace casacore { //# NAMESPACE CASACORE - BEGIN
40 
41 //# Forward Declarations
42 template <class T> class Quantum;
43 
44 // <summary> Internal value for MRadialVelocity </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="tcornwel" date="1996/02/23" tests="tMeasMath" demos="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> <linkto class=MeasValue>MeasValue</linkto>
53 // </prerequisite>
54 //
55 // <etymology>
56 // From Measure, Value and Radial Velocity
57 // </etymology>
58 //
59 // <synopsis>
60 // An MVRadialVelocity is a simple Double, to be used in the MRadialVelocity
61 // measure.
62 // Requirements can be found in the
63 // <linkto class=MeasValue>MeasValue</linkto> base class.<br>
64 // The only reasonable constructor is (but all MeasValue constructors are
65 // present)
66 // <src>MVRadialVelocity(Double)</src>; and an <src>operator Double</src> takes
67 // care of all other possibilities. Its external use is for
68 // <linkto class=MeasConvert>MeasConvert</linkto>, to distinguish between
69 // input in internal Measure units, and values which have to have
70 // units applied.<br>
71 // The MVRadialVelocity(Quantum) constructors recognise the type of wave
72 // characteristics presented from its units. Recognised are:
73 // <ul>
74 // <li> velocity (length/time)
75 // </ul>
76 // <br> The velocity is returned in m/s with getValue(); or as a Quantity
77 // in m/s with get(); or in the specified units with get(unit).
78 //
79 // A <em>shiftFrequency()</em> method can shift frequencies.
80 // </synopsis>
81 //
82 // <example>
83 // See <linkto class=MRadialVelocity>MRadialVelocity</linkto>
84 // </example>
85 //
86 // <motivation>
87 // To aid coordinate transformations possibilities
88 // </motivation>
89 //
90 // <todo asof="1996/04/15">
91 // </todo>
92 
93 class MVRadialVelocity : public MeasValue {
94 
95 public:
96 
97  //# Constructors
98  // Default constructor: generate a zero value
100  // Copy constructor
101  MVRadialVelocity(const MVRadialVelocity &other);
102  // Copy assignment
104  // Constructor from Double (assume m/s)
106  // Constructor from Quantum
107  // <group>
108  MVRadialVelocity(const Quantity &other);
109  MVRadialVelocity(const Quantum<Vector<Double> > &other);
110  // </group>
111  // Constructor from Vector. A zero value will be taken for an empty vector,
112  // the first element for a quantum vector.
113  // <thrown>
114  // <li> AipsError if vector length > 1
115  // </thrown>
116  // <group>
117  MVRadialVelocity(const Vector<Double> &other);
118  MVRadialVelocity(const Vector<Quantity> &other);
119  // </group>
120 
121  // Destructor
123 
124  //# Operators
125  // Conversion operator
126  operator Double() const;
127 
128  // Addition
129  // <group>
132  // </group>
133  // Comparisons
134  // <group>
135  Bool operator==(const MVRadialVelocity &other) const;
136  Bool operator!=(const MVRadialVelocity &other) const;
137  Bool near(const MVRadialVelocity &other, Double tol = 1e-13) const;
138  Bool nearAbs(const MVRadialVelocity &other, Double tol = 1e-13) const;
139  // </group>
140 
141  //# General member functions
142 
143  // Tell me your type
144  // <group>
145  static void assure(const MeasValue &in);
146  // </group>
147 
148  // Print data
149  virtual void print(ostream &os) const;
150  // Clone
151  virtual MeasValue *clone() const;
152  // Adjust value: taken from base class, a NOP.
153  // Get value in m/s
154  Double getValue() const;
155  // Get quantity in m/s
156  Quantity get() const;
157  // Get the wave characteristics in (recognised) specified units
158  Quantity get(const Unit &unit) const;
159  // Get the value in internal units
160  virtual Vector<Double> getVector() const;
161  // Set the value from internal units (set 0 for empty vector)
162  virtual void putVector(const Vector<Double> &in);
163  // Get the internal value as a <src>Vector<Quantity></src>. Usable in
164  // records. The getXRecordValue() gets additional information for records.
165  // Note that the Vectors could be empty.
166  // <group>
167  virtual Vector<Quantum<Double> > getRecordValue() const;
168  // </group>
169  // Set the internal value if correct values and dimensions
170  virtual Bool putValue(const Vector<Quantum<Double> > &in);
171  // Shift the input frequencies to the output frequencies. In the case of
172  // simple Double inputs, it is assumed that the values are linearly dependent
173  // on frequency. I.e. frequencies given as wavelength or time cannot be used.
174  // <group>
175  Vector<Double> shiftFrequency(const Vector<Double> &freq) const;
177  shiftFrequency(const Quantum<Vector<Double> > &freq) const;
178  // </group>
179 
180 private:
181  //# Data
182  // Value
184 
185  //# Member functions
186  // Get correct data type conversion factor from input Quantum
187  Double makeF(const Unit &dt) const;
188 };
189 
190 
191 } //# NAMESPACE CASACORE - END
192 
193 #endif
virtual void print(ostream &os) const
Print data.
Bool nearAbs(const MVRadialVelocity &other, Double tol=1e-13) const
Double makeF(const Unit &dt) const
Get correct data type conversion factor from input Quantum.
MVRadialVelocity & operator-=(const MVRadialVelocity &other)
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector)
defines physical units
Definition: Unit.h:189
Internal value for MRadialVelocity.
Base class for values in a Measure.
Definition: MeasValue.h:107
virtual Bool putValue(const Vector< Quantum< Double > > &in)
Set the internal value if correct values and dimensions.
Vector< Double > shiftFrequency(const Vector< Double > &freq) const
Shift the input frequencies to the output frequencies.
Bool near(const MVRadialVelocity &other, Double tol=1e-13) const
double Double
Definition: aipstype.h:55
MVRadialVelocity & operator+=(const MVRadialVelocity &other)
Addition.
MVRadialVelocity & operator=(const MVRadialVelocity &other)
Copy assignment.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual MeasValue * clone() const
Clone.
virtual Vector< Double > getVector() const
Get the value in internal units.
MVRadialVelocity()
Default constructor: generate a zero value.
Bool operator==(const MVRadialVelocity &other) const
Comparisons.
const Double e
e and functions thereof:
Bool operator!=(const MVRadialVelocity &other) const
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector&lt;Quantity&gt;.
Double getValue() const
Adjust value: taken from base class, a NOP.
static void assure(const MeasValue &in)
Tell me your type.
~MVRadialVelocity()
Destructor.