casacore
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: 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_MVDOPPLER_H
29 #define CASA_MVDOPPLER_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/casa/Arrays/Vector.h>
35 #include <casacore/casa/Quanta/QC.h>
36 #include <casacore/casa/Quanta/Quantum.h>
37 #include <casacore/casa/Quanta/MeasValue.h>
38 #include <casacore/casa/iosfwd.h>
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 //# Forward Declarations
43 
44 // <summary> Internal value for MDoppler </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="tcornwel" date="1996/02/23" tests="tMeasMath" demos="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> <linkto class=MeasValue>MeasValue</linkto>
53 // </prerequisite>
54 //
55 // <etymology>
56 // From Measure, Value and Doppler
57 // </etymology>
58 //
59 // <synopsis>
60 // An MVDoppler is a simple Double, to be used in the MDoppler measure.
61 // Requirements can be found in the
62 // <linkto class=MeasValue>MeasValue</linkto> base class.<br>
63 // The only reasonable constructor is (but all MeasValue constructors are
64 // present)
65 // <src>MVDoppler(Double)</src>; and an <src>operator Double</src> takes
66 // care of all other possibilities. Its external use is for
67 // <linkto class=MeasConvert>MeasConvert</linkto>, to distinguish between
68 // input in internal Measure units, and values which have to have
69 // units applied.<br>
70 // The MVDoppler(Quantum) constructors recognise the type of representation
71 // characteristics presented from its units. Recognised are:
72 // <ul>
73 // <li> no dimensions: value assumed to be dimensionless as is
74 // <li> velocity: value will be divided by c (light velocity)
75 // </ul>
76 // <br> The Doppler is returned dimensionless with getValue(); or as a Quantity
77 // in m/s with get(); or in one of the related units with get(unit).
78 // </synopsis>
79 //
80 // <example>
81 // See <linkto class=MDoppler>MDoppler</linkto>
82 // </example>
83 //
84 // <motivation>
85 // To aid coordinate transformations possibilities
86 // </motivation>
87 //
88 // <todo asof="1996/04/15">
89 // </todo>
90 
91 class MVDoppler : public MeasValue {
92 
93 public:
94 
95  //# Constructors
96  // Default constructor: generate a zero value
98  // Copy constructor
99  MVDoppler(const MVDoppler &other);
100  // Copy assignment
101  MVDoppler &operator=(const MVDoppler &other);
102  // Constructor from Double
104  // Constructor from Quantum : value taken will be the canonical value
105  // <group>
106  MVDoppler(const Quantity &other);
108  // </group>
109  // Constructor from Vector. A zero value will be taken for an empty vector,
110  // the canonical value for a quantum vector.
111  // <thrown>
112  // <li> AipsError if vector length > 1
113  // </thrown>
114  // <group>
115  MVDoppler(const Vector<Double> &other);
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 MVDoppler &other) const;
134  Bool operator!=(const MVDoppler &other) const;
135  Bool near(const MVDoppler &other, Double tol = 1e-13) const;
136  Bool nearAbs(const MVDoppler &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 as ratio
152  Double getValue() const;
153  // Get quantity in m/s
154  Quantity get() const;
155  // Get the Doppler value 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 
170 private:
171  //# Data
172  // Value
174 
175  //# Member functions
176  // Get correct data type conversion factor from input Quantum
177  Double makeD(Double v, const Unit &dt, Bool rev=False) const;
178 };
179 
180 
181 } //# NAMESPACE CASACORE - END
182 
183 #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.
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector<Quantity>.
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
virtual Vector< Double > getVector() const
Get the value in internal units.
Bool operator==(const MVDoppler &other) const
Comparisons.
Double val
Value.
Definition: MVDoppler.h:173
MVDoppler(const MVDoppler &other)
Copy constructor.
virtual MeasValue * clone() const
Clone.
MVDoppler()
Default constructor: generate a zero value.
MVDoppler & operator-=(const MVDoppler &other)
MVDoppler(const Quantum< Vector< Double > > &other)
Bool nearAbs(const MVDoppler &other, Double tol=1e-13) const
~MVDoppler()
Destructor.
MVDoppler(const Vector< Quantity > &other)
Double getValue() const
Adjust value: taken from base class, a NOP.
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.
MVDoppler & operator=(const MVDoppler &other)
Copy assignment.
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector)
MVDoppler & operator+=(const MVDoppler &other)
Addition.
const Double e
e and functions thereof:
this file contains all the compiler specific defines
Definition: mainpage.dox:28
const Bool False
Definition: aipstype.h:44
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
double Double
Definition: aipstype.h:55