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