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