casacore
Loading...
Searching...
No Matches
MVDoppler.h
Go to the documentation of this file.
1// # MVDoppler.h: Internal value for MDoppler
2// # Copyright (C) 1996,1997,1998,1999,2000,2001
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_MVDOPPLER_H
27#define CASA_MVDOPPLER_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/casa/Quanta/QC.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
40
41// <summary> Internal value for MDoppler </summary>
42
43// <use visibility=export>
44
45// <reviewed reviewer="tcornwel" date="1996/02/23" tests="tMeasMath" demos="">
46// </reviewed>
47
48// <prerequisite>
49// <li> <linkto class=MeasValue>MeasValue</linkto>
50// </prerequisite>
51//
52// <etymology>
53// From Measure, Value and Doppler
54// </etymology>
55//
56// <synopsis>
57// An MVDoppler is a simple Double, to be used in the MDoppler measure.
58// Requirements can be found in the
59// <linkto class=MeasValue>MeasValue</linkto> base class.<br>
60// The only reasonable constructor is (but all MeasValue constructors are
61// present)
62// <src>MVDoppler(Double)</src>; and an <src>operator Double</src> takes
63// care of all other possibilities. Its external use is for
64// <linkto class=MeasConvert>MeasConvert</linkto>, to distinguish between
65// input in internal Measure units, and values which have to have
66// units applied.<br>
67// The MVDoppler(Quantum) constructors recognise the type of representation
68// characteristics presented from its units. Recognised are:
69// <ul>
70// <li> no dimensions: value assumed to be dimensionless as is
71// <li> velocity: value will be divided by c (light velocity)
72// </ul>
73// <br> The Doppler is returned dimensionless with getValue(); or as a Quantity
74// in m/s with get(); or in one of the related units with get(unit).
75// </synopsis>
76//
77// <example>
78// See <linkto class=MDoppler>MDoppler</linkto>
79// </example>
80//
81// <motivation>
82// To aid coordinate transformations possibilities
83// </motivation>
84//
85// <todo asof="1996/04/15">
86// </todo>
87
88class MVDoppler : public MeasValue {
89 public:
90 // # Constructors
91 // Default constructor: generate a zero value
93 // Copy constructor
94 MVDoppler(const MVDoppler &other);
95 // Copy assignment
97 // Constructor from Double
99 // Constructor from Quantum : value taken will be the canonical value
100 // <group>
101 MVDoppler(const Quantity &other);
103 // </group>
104 // Constructor from Vector. A zero value will be taken for an empty vector,
105 // the canonical value for a quantum vector.
106 // <thrown>
107 // <li> AipsError if vector length > 1
108 // </thrown>
109 // <group>
112 // </group>
113
114 // Destructor
116
117 // # Operators
118 // Conversion operator
119 operator Double() const;
120
121 // Addition
122 // <group>
125 // </group>
126 // Comparisons
127 // <group>
128 Bool operator==(const MVDoppler &other) const;
129 Bool operator!=(const MVDoppler &other) const;
130 Bool near(const MVDoppler &other, Double tol = 1e-13) const;
131 Bool nearAbs(const MVDoppler &other, Double tol = 1e-13) const;
132 // </group>
133
134 // # General member functions
135
136 // Tell me your type
137 // <group>
138 static void assure(const MeasValue &in);
139 // </group>
140
141 // Print data
142 virtual void print(ostream &os) const;
143 // Clone
144 virtual MeasValue *clone() const;
145 // Adjust value: taken from base class, a NOP.
146 // Get value as ratio
148 // Get quantity in m/s
149 Quantity get() const;
150 // Get the Doppler value in (recognised) specified units
151 Quantity get(const Unit &unit) const;
152 // Get the value in internal units
153 virtual Vector<Double> getVector() const;
154 // Set the value from internal units (set 0 for empty vector)
155 virtual void putVector(const Vector<Double> &in);
156 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
157 // records. The getXRecordValue() gets additional information for records.
158 // Note that the Vectors could be empty.
159 // <group>
161 // </group>
162 // Set the internal value if correct values and dimensions
163 virtual Bool putValue(const Vector<Quantum<Double>> &in);
164
165 private:
166 // # Data
167 // Value
169
170 // # Member functions
171 // Get correct data type conversion factor from input Quantum
172 Double makeD(Double v, const Unit &dt, Bool rev = False) const;
173};
174
175} // namespace casacore
176
177#endif
Double makeD(Double v, const Unit &dt, Bool rev=False) const
Get correct data type conversion factor from input Quantum.
Quantity get(const Unit &unit) const
Get the Doppler value in (recognised) specified units.
MVDoppler(const Vector< Double > &other)
Constructor from Vector.
MVDoppler(const Quantity &other)
Constructor from Quantum : value taken will be the canonical value.
Bool near(const MVDoppler &other, Double tol=1e-13) const
Bool operator!=(const MVDoppler &other) const
Bool operator==(const MVDoppler &other) const
Comparisons.
virtual Vector< Double > getVector() const
Get the value in internal units.
Double val
Value.
Definition MVDoppler.h:168
MVDoppler(const MVDoppler &other)
Copy constructor.
MVDoppler()
Default constructor: generate a zero value.
MVDoppler & operator-=(const MVDoppler &other)
MVDoppler & operator+=(const MVDoppler &other)
Addition.
MVDoppler(const Quantum< Vector< Double > > &other)
Bool nearAbs(const MVDoppler &other, Double tol=1e-13) const
~MVDoppler()
Destructor.
MVDoppler & operator=(const MVDoppler &other)
Copy assignment.
virtual MeasValue * clone() const
Clone.
MVDoppler(const Vector< Quantity > &other)
Double getValue() const
Adjust value: taken from base class, a NOP.
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector<Quantity>.
virtual void print(ostream &os) const
Print data.
virtual Bool putValue(const Vector< Quantum< Double > > &in)
Set the internal value if correct values and dimensions.
MVDoppler(Double d)
Constructor from Double.
static void assure(const MeasValue &in)
Tell me your type.
Quantity get() const
Get quantity in m/s.
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector).
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
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