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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/Vector.h>
33#include <casacore/casa/Quanta/QC.h>
34#include <casacore/casa/Quanta/Quantum.h>
35#include <casacore/casa/Quanta/MeasValue.h>
36#include <casacore/casa/iosfwd.h>
37
38namespace casacore { //# NAMESPACE CASACORE - BEGIN
39
40//# Forward Declarations
41
42// <summary> Internal value for MDoppler </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 Doppler
55// </etymology>
56//
57// <synopsis>
58// An MVDoppler is a simple Double, to be used in the MDoppler measure.
59// Requirements can be found in the
60// <linkto class=MeasValue>MeasValue</linkto> base class.<br>
61// The only reasonable constructor is (but all MeasValue constructors are
62// present)
63// <src>MVDoppler(Double)</src>; and an <src>operator Double</src> takes
64// care of all other possibilities. Its external use is for
65// <linkto class=MeasConvert>MeasConvert</linkto>, to distinguish between
66// input in internal Measure units, and values which have to have
67// units applied.<br>
68// The MVDoppler(Quantum) constructors recognise the type of representation
69// characteristics presented from its units. Recognised are:
70// <ul>
71// <li> no dimensions: value assumed to be dimensionless as is
72// <li> velocity: value will be divided by c (light velocity)
73// </ul>
74// <br> The Doppler is returned dimensionless with getValue(); or as a Quantity
75// in m/s with get(); or in one of the related units with get(unit).
76// </synopsis>
77//
78// <example>
79// See <linkto class=MDoppler>MDoppler</linkto>
80// </example>
81//
82// <motivation>
83// To aid coordinate transformations possibilities
84// </motivation>
85//
86// <todo asof="1996/04/15">
87// </todo>
88
89class MVDoppler : public MeasValue {
90
91public:
92
93 //# Constructors
94 // Default constructor: generate a zero value
96 // Copy constructor
97 MVDoppler(const MVDoppler &other);
98 // Copy assignment
100 // Constructor from Double
102 // Constructor from Quantum : value taken will be the canonical value
103 // <group>
104 MVDoppler(const Quantity &other);
106 // </group>
107 // Constructor from Vector. A zero value will be taken for an empty vector,
108 // the canonical value 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 MVDoppler &other) const;
132 Bool operator!=(const MVDoppler &other) const;
133 Bool near(const MVDoppler &other, Double tol = 1e-13) const;
134 Bool nearAbs(const MVDoppler &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 as ratio
151 // Get quantity in m/s
152 Quantity get() const;
153 // Get the Doppler value 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
168private:
169 //# Data
170 // Value
172
173 //# Member functions
174 // Get correct data type conversion factor from input Quantum
175 Double makeD(Double v, const Unit &dt, Bool rev=False) const;
176};
177
178
179} //# NAMESPACE CASACORE - END
180
181#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:171
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)
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53