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