casa
$Rev:20696$
|
00001 //# MVDoppler.h: Internal value for MDoppler 00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: MVDoppler.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $ 00027 00028 #ifndef CASA_MVDOPPLER_H 00029 #define CASA_MVDOPPLER_H 00030 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <casa/Arrays/Vector.h> 00035 #include <casa/Quanta/QC.h> 00036 #include <casa/Quanta/Quantum.h> 00037 #include <casa/Quanta/MeasValue.h> 00038 #include <casa/iosfwd.h> 00039 00040 namespace casa { //# NAMESPACE CASA - BEGIN 00041 00042 //# Forward Declarations 00043 00044 // <summary> Internal value for MDoppler </summary> 00045 00046 // <use visibility=export> 00047 00048 // <reviewed reviewer="tcornwel" date="1996/02/23" tests="tMeasMath" demos=""> 00049 // </reviewed> 00050 00051 // <prerequisite> 00052 // <li> <linkto class=MeasValue>MeasValue</linkto> 00053 // </prerequisite> 00054 // 00055 // <etymology> 00056 // From Measure, Value and Doppler 00057 // </etymology> 00058 // 00059 // <synopsis> 00060 // An MVDoppler is a simple Double, to be used in the MDoppler measure. 00061 // Requirements can be found in the 00062 // <linkto class=MeasValue>MeasValue</linkto> base class.<br> 00063 // The only reasonable constructor is (but all MeasValue constructors are 00064 // present) 00065 // <src>MVDoppler(Double)</src>; and an <src>operator Double</src> takes 00066 // care of all other possibilities. Its external use is for 00067 // <linkto class=MeasConvert>MeasConvert</linkto>, to distinguish between 00068 // input in internal Measure units, and values which have to have 00069 // units applied.<br> 00070 // The MVDoppler(Quantum) constructors recognise the type of representation 00071 // characteristics presented from its units. Recognised are: 00072 // <ul> 00073 // <li> no dimensions: value assumed to be dimensionless as is 00074 // <li> velocity: value will be divided by c (light velocity) 00075 // </ul> 00076 // <br> The Doppler is returned dimensionless with getValue(); or as a Quantity 00077 // in m/s with get(); or in one of the related units with get(unit). 00078 // </synopsis> 00079 // 00080 // <example> 00081 // See <linkto class=MDoppler>MDoppler</linkto> 00082 // </example> 00083 // 00084 // <motivation> 00085 // To aid coordinate transformations possibilities 00086 // </motivation> 00087 // 00088 // <todo asof="1996/04/15"> 00089 // </todo> 00090 00091 class MVDoppler : public MeasValue { 00092 00093 public: 00094 00095 //# Constructors 00096 // Default constructor: generate a zero value 00097 MVDoppler(); 00098 // Copy constructor 00099 MVDoppler(const MVDoppler &other); 00100 // Copy assignment 00101 MVDoppler &operator=(const MVDoppler &other); 00102 // Constructor from Double 00103 MVDoppler(Double d); 00104 // Constructor from Quantum : value taken will be the canonical value 00105 // <group> 00106 MVDoppler(const Quantity &other); 00107 MVDoppler(const Quantum<Vector<Double> > &other); 00108 // </group> 00109 // Constructor from Vector. A zero value will be taken for an empty vector, 00110 // the canonical value for a quantum vector. 00111 // <thrown> 00112 // <li> AipsError if vector length > 1 00113 // </thrown> 00114 // <group> 00115 MVDoppler(const Vector<Double> &other); 00116 MVDoppler(const Vector<Quantity> &other); 00117 // </group> 00118 00119 // Destructor 00120 ~MVDoppler(); 00121 00122 //# Operators 00123 // Conversion operator 00124 operator Double() const; 00125 00126 // Addition 00127 // <group> 00128 MVDoppler &operator+=(const MVDoppler &other); 00129 MVDoppler &operator-=(const MVDoppler &other); 00130 // </group> 00131 // Comparisons 00132 // <group> 00133 Bool operator==(const MVDoppler &other) const; 00134 Bool operator!=(const MVDoppler &other) const; 00135 Bool near(const MVDoppler &other, Double tol = 1e-13) const; 00136 Bool nearAbs(const MVDoppler &other, Double tol = 1e-13) const; 00137 // </group> 00138 00139 //# General member functions 00140 00141 // Tell me your type 00142 // <group> 00143 virtual uInt type() const; 00144 static void assure(const MeasValue &in); 00145 // </group> 00146 00147 // Print data 00148 virtual void print(ostream &os) const; 00149 // Clone 00150 virtual MeasValue *clone() const; 00151 // Adjust value: taken from base class, a NOP. 00152 // Get value as ratio 00153 Double getValue() const; 00154 // Get quantity in m/s 00155 Quantity get() const; 00156 // Get the Doppler value in (recognised) specified units 00157 Quantity get(const Unit &unit) const; 00158 // Get the value in internal units 00159 virtual Vector<Double> getVector() const; 00160 // Set the value from internal units (set 0 for empty vector) 00161 virtual void putVector(const Vector<Double> &in); 00162 // Get the internal value as a <src>Vector<Quantity></src>. Usable in 00163 // records. The getXRecordValue() gets additional information for records. 00164 // Note that the Vectors could be empty. 00165 // <group> 00166 virtual Vector<Quantum<Double> > getRecordValue() const; 00167 // </group> 00168 // Set the internal value if correct values and dimensions 00169 virtual Bool putValue(const Vector<Quantum<Double> > &in); 00170 00171 private: 00172 //# Data 00173 // Value 00174 Double val; 00175 00176 //# Member functions 00177 // Get correct data type conversion factor from input Quantum 00178 Double makeD(Double v, const Unit &dt, Bool rev=False) const; 00179 }; 00180 00181 00182 } //# NAMESPACE CASA - END 00183 00184 #endif