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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/Vector.h>
33#include <casacore/casa/Quanta/Quantum.h>
34#include <casacore/casa/Quanta/MeasValue.h>
35#include <casacore/casa/iosfwd.h>
36
37namespace casacore { //# NAMESPACE CASACORE - BEGIN
38
39//# Forward Declarations
40template <class T> class 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
93public:
94
95 //# Constructors
96 // Default constructor: generate a zero value
98 // Copy constructor
100 // Copy assignment
102 // Constructor from Double (assume m/s)
104 // Constructor from Quantum
105 // <group>
108 // </group>
109 // Constructor from Vector. A zero value will be taken for an empty vector,
110 // the first element for a quantum vector.
111 // <thrown>
112 // <li> AipsError if vector length > 1
113 // </thrown>
114 // <group>
117 // </group>
118
119 // Destructor
121
122 //# Operators
123 // Conversion operator
124 operator Double() const;
125
126 // Addition
127 // <group>
130 // </group>
131 // Comparisons
132 // <group>
133 Bool operator==(const MVRadialVelocity &other) const;
134 Bool operator!=(const MVRadialVelocity &other) const;
135 Bool near(const MVRadialVelocity &other, Double tol = 1e-13) const;
136 Bool nearAbs(const MVRadialVelocity &other, Double tol = 1e-13) const;
137 // </group>
138
139 //# General member functions
140
141 // Tell me your type
142 // <group>
143 static void assure(const MeasValue &in);
144 // </group>
145
146 // Print data
147 virtual void print(ostream &os) const;
148 // Clone
149 virtual MeasValue *clone() const;
150 // Adjust value: taken from base class, a NOP.
151 // Get value in m/s
153 // Get quantity in m/s
154 Quantity get() const;
155 // Get the wave characteristics in (recognised) specified units
156 Quantity get(const Unit &unit) const;
157 // Get the value in internal units
158 virtual Vector<Double> getVector() const;
159 // Set the value from internal units (set 0 for empty vector)
160 virtual void putVector(const Vector<Double> &in);
161 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
162 // records. The getXRecordValue() gets additional information for records.
163 // Note that the Vectors could be empty.
164 // <group>
166 // </group>
167 // Set the internal value if correct values and dimensions
168 virtual Bool putValue(const Vector<Quantum<Double> > &in);
169 // Shift the input frequencies to the output frequencies. In the case of
170 // simple Double inputs, it is assumed that the values are linearly dependent
171 // on frequency. I.e. frequencies given as wavelength or time cannot be used.
172 // <group>
176 // </group>
177
178private:
179 //# Data
180 // Value
182
183 //# Member functions
184 // Get correct data type conversion factor from input Quantum
185 Double makeF(const Unit &dt) const;
186};
187
188
189} //# NAMESPACE CASACORE - END
190
191#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.
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53