casacore
QC.h
Go to the documentation of this file.
1//# QC.h: physical constants with units
2//# Copyright (C) 1994,1995,1996,1997,1998,1999
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_QC_H
29#define CASA_QC_H
30
31
32//# Includes
33#include <casacore/casa/aips.h>
34#include <casacore/casa/BasicSL/Constants.h>
35#include <casacore/casa/Quanta/Quantum.h>
36
37namespace casacore { //# NAMESPACE CASACORE - BEGIN
38
39//# Forward Declarations
40
41//# Typedefs
42
43// <summary>
44// Physical constants (i.e. dimensioned values)
45// </summary>
46
47// <use visibility=export>
48
49// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tQuantum">
50
51// <prerequisite>
52// <li> <linkto class=Quantum>Quantum</linkto>
53// </prerequisite>
54
55// <etymology>
56// A QC is based on the Quantum and C (constants) class
57// </etymology>
58
59// <synopsis>
60// QC:name will produce a Quantity (Quantum&lt;Double&gt;) value consisting of
61// a value and a unit. See the <linkto class=Quantum>Quantum</linkto> class
62// for possibilities of manipulating quanta.
63// tQuantum will give a list of the currently available constants
64// </synopsis>
65
66// <example>
67// To obtain the velocity of light in pc/a, use:
68// <srcblock>
69// #include <casacore/casa/Quanta.h>
70// Double vel_pcpy = (C::c).convert("pc/a").getValue();
71// </srcblock>
72// </example>
73
74//############################################################################
75//# NOTE: Delete the following listing of the public data members when
76//# public data members are handled properly by the documentation
77//# extractor.
78//############################################################################
79
80// The following constants are defined as public data members of class QC.
81//
82// <note role=caution>
83// The following public data member documentation is currently extracted by
84// hand, and thus could be out of date if this documentation was not updated
85// when the class was modified.
86// </note>
87
88// <srcblock>
89//
90// // vel of light
91// Quantum<Double> c( );
92//
93// // Gravitational constant
94// Quantum<Double> G( );
95//
96// // Planck
97// Quantum<Double> h( );
98//
99// // HI line
100// Quantum<Double> HI( );
101//
102// // Gas constant
103// Quantum<Double> R( );
104//
105// // Avogadro
106// Quantum<Double> NA( );
107//
108// // electron charge
109// Quantum<Double> e( );
110//
111// // proton mass
112// Quantum<Double> mp( );
113//
114// // mp/me
115// Quantum<Double> mp_me( );
116//
117// // permeability vacuum
118// Quantum<Double> mu0( );
119//
120// // permittivity vacuum
121// Quantum<Double> epsilon0( );
122//
123// // Boltzmann
124// Quantum<Double> k( );
125//
126// // Faraday
127// Quantum<Double> F( );
128//
129// // mass electron
130// Quantum<Double> me( );
131//
132// // radius electron
133// Quantum<Double> re( );
134//
135// // Bohr's radius
136// Quantum<Double> a0( );
137//
138// // Solar radius
139// Quantum<Double> R0( );
140//
141// // IAU Gaussian grav. const **2
142// Quantum<Double> k2( );
143//
144// // quarter turn = 90 degrees = pi/2 radians
145// Quantum<Double> qTurn( );
146//
147// // half turn = 180 degrees = pi radians
148// Quantum<Double> hTurn( );
149//
150// // full turn = 360 degrees = 2pi radians
151// Quantum<Double> fTurn( );
152//
153// </srcblock>
154
155// <motivation>
156// Physical constants should be known with their proper dimensions
157// </motivation>
158//
159// <todo asof="941110">
160// </todo>
161
162class QC {
163friend class QC_init;
164public:
165
166//# If you change any of the public data members, make the corresponding
167//# change above to the documentation of the public data members.
168
169 // vel of light
170 inline static const Quantum<Double> &c( ) {
171 static Quantum<Double> result(C::c,"m/s");
172 return result;
173 }
174
175 // Gravitational constant
176 inline static const Quantum<Double> &G( ) {
177 static Quantum<Double> result(6.67259e-11,"N.m2/kg2");
178 return result;
179 }
180
181 // Planck
182 inline static const Quantum<Double> &h( ) {
183 static Quantum<Double> result(6.6260755e-34,"J.s");
184 return result;
185 }
186
187 // HI line
188 inline static const Quantum<Double> &HI( ) {
189 static Quantum<Double> result(1420.405751786, "MHz");
190 return result;
191 }
192
193 // Gas constant
194 inline static Quantum<Double> &R( ) {
195 static Quantum<Double> result(8.314510,"J/K/mol");
196 return result;
197 }
198
199 // Avogadro
200 inline static const Quantum<Double> &NA( ) {
201 static Quantum<Double> result(6.0221367e+23,"mol-1");
202 return result;
203 }
204
205 // electron charge
206 inline static const Quantum<Double> &e( ) {
207 static Quantum<Double> result(1.60217733e-19,"C");
208 return result;
209 }
210
211 // proton mass
212 inline static const Quantum<Double> &mp( ) {
213 static Quantum<Double> result(1.6726231e-27,"kg");
214 return result;
215 }
216
217 // mp/me
218 inline static const Quantum<Double> &mp_me( ) {
219 static Quantum<Double> result(1836.152701,"");
220 return result;
221 }
222
223 // permeability vacuum
224 inline static const Quantum<Double> &mu0( ) {
225 static Quantum<Double> result(4.0e-7*C::pi,"H/m");
226 return result;
227 }
228
229 // permittivity vacuum
230 inline static const Quantum<Double> &epsilon0( ) {
231 static Quantum<Double> result(1.0/(4.0e-7*C::pi*C::c*C::c),"F/m");
232 return result;
233 }
234
235 // Boltzmann
236 inline static const Quantum<Double> &k( ) {
237 static Quantum<Double> result(8.314510/6.0221367e+23,"J/K");
238 return result;
239 }
240
241 // Faraday
242 inline static const Quantum<Double> &F( ) {
243 static Quantum<Double> result(6.0221367e+23*1.60217733e-19,"C/mol");
244 return result;
245 }
246
247 // mass electron
248 inline static const Quantum<Double> &me( ) {
249 static Quantum<Double> result(1.6726231e-27/1836.152701,"kg");
250 return result;
251 }
252
253 // radius electron
254 inline static const Quantum<Double> &re( ) {
255 static Quantum<Double> result(2.8179e-15,"m");
256 return result;
257 }
258
259 // Bohr's radius
260 inline static const Quantum<Double> &a0( ) {
261 static Quantum<Double> result(5.2918e-11,"m");
262 return result;
263 }
264
265 // Solar radius
266 inline static const Quantum<Double> &R0( ) {
267 static Quantum<Double> result(6.9599e+08,"m");
268 return result;
269 }
270
271
272 // IAU Gaussian grav. const **2
273 inline static const Quantum<Double> &k2( ) {
274 const Double IAU_k=0.01720209895;
275 static Quantum<Double> result(IAU_k*IAU_k,"AU3/d2/S0");
276 return result;
277 }
278
279 // quarter turn = 90 degrees = pi/2 radians
280 inline static const Quantum<Double> &qTurn( ) {
281 static Quantum<Double> result(90.0, "deg");
282 return result;
283 }
284
285 // half turn = 180 degrees = pi radians
286 inline static const Quantum<Double> &hTurn( ) {
287 static Quantum<Double> result(180.0, "deg");
288 return result;
289 }
290
291 // full turn = 360 degrees = 2pi radians
292 inline static const Quantum<Double> &fTurn( ) {
293 static Quantum<Double> result(360.0, "deg");
294 return result;
295 }
296
297};
298
299} //# NAMESPACE CASACORE - END
300
301#endif
static const Quantum< Double > & k2()
IAU Gaussian grav.
Definition: QC.h:273
static const Quantum< Double > & hTurn()
half turn = 180 degrees = pi radians
Definition: QC.h:286
static const Quantum< Double > & mp()
proton mass
Definition: QC.h:212
static const Quantum< Double > & F()
Faraday.
Definition: QC.h:242
static const Quantum< Double > & HI()
HI line.
Definition: QC.h:188
static const Quantum< Double > & k()
Boltzmann.
Definition: QC.h:236
static const Quantum< Double > & R0()
Solar radius.
Definition: QC.h:266
static const Quantum< Double > & mu0()
permeability vacuum
Definition: QC.h:224
static const Quantum< Double > & h()
Planck.
Definition: QC.h:182
static const Quantum< Double > & c()
vel of light
Definition: QC.h:170
static const Quantum< Double > & epsilon0()
permittivity vacuum
Definition: QC.h:230
friend class QC_init
Definition: QC.h:163
static const Quantum< Double > & mp_me()
mp/me
Definition: QC.h:218
static const Quantum< Double > & qTurn()
quarter turn = 90 degrees = pi/2 radians
Definition: QC.h:280
static const Quantum< Double > & a0()
Bohr's radius.
Definition: QC.h:260
static const Quantum< Double > & e()
electron charge
Definition: QC.h:206
static const Quantum< Double > & me()
mass electron
Definition: QC.h:248
static const Quantum< Double > & fTurn()
full turn = 360 degrees = 2pi radians
Definition: QC.h:292
static const Quantum< Double > & NA()
Avogadro.
Definition: QC.h:200
static Quantum< Double > & R()
Gas constant.
Definition: QC.h:194
static const Quantum< Double > & G()
Gravitational constant.
Definition: QC.h:176
static const Quantum< Double > & re()
radius electron
Definition: QC.h:254
const Double pi
Pi and functions thereof:
const Double c
Fundamental physical constants (SI units):
this file contains all the compiler specific defines
Definition: mainpage.dox:28
const Double IAU_k
Definition: UnitMap.h:73
double Double
Definition: aipstype.h:55