//# QC.h: physical constants with units //# Copyright (C) 1994,1995,1996,1997,1998,1999 //# Associated Universities, Inc. Washington DC, USA. //# //# This library is free software; you can redistribute it and/or modify it //# under the terms of the GNU Library General Public License as published by //# the Free Software Foundation; either version 2 of the License, or (at your //# option) any later version. //# //# This library is distributed in the hope that it will be useful, but WITHOUT //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public //# License for more details. //# //# You should have received a copy of the GNU Library General Public License //# along with this library; if not, write to the Free Software Foundation, //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. //# //# Correspondence concerning AIPS++ should be addressed as follows: //# Internet email: aips2-request@nrao.edu. //# Postal address: AIPS++ Project Office //# National Radio Astronomy Observatory //# 520 Edgemont Road //# Charlottesville, VA 22903-2475 USA //# //# $Id$ #ifndef CASA_QC_H #define CASA_QC_H //# Includes #include #include #include namespace casacore { //# NAMESPACE CASACORE - BEGIN //# Forward Declarations //# Typedefs // // Physical constants (i.e. dimensioned values) // // // // //
  • Quantum // // // A QC is based on the Quantum and C (constants) class // // // QC:name will produce a Quantity (Quantum<Double>) value consisting of // a value and a unit. See the Quantum class // for possibilities of manipulating quanta. // tQuantum will give a list of the currently available constants // // // To obtain the velocity of light in pc/a, use: // // #include // Double vel_pcpy = (C::c).convert("pc/a").getValue(); // // //############################################################################ //# NOTE: Delete the following listing of the public data members when //# public data members are handled properly by the documentation //# extractor. //############################################################################ // The following constants are defined as public data members of class QC. // // // The following public data member documentation is currently extracted by // hand, and thus could be out of date if this documentation was not updated // when the class was modified. // // // // // vel of light // Quantum c( ); // // // Gravitational constant // Quantum G( ); // // // Planck // Quantum h( ); // // // HI line // Quantum HI( ); // // // Gas constant // Quantum R( ); // // // Avogadro // Quantum NA( ); // // // electron charge // Quantum e( ); // // // proton mass // Quantum mp( ); // // // mp/me // Quantum mp_me( ); // // // permeability vacuum // Quantum mu0( ); // // // permittivity vacuum // Quantum epsilon0( ); // // // Boltzmann // Quantum k( ); // // // Faraday // Quantum F( ); // // // mass electron // Quantum me( ); // // // radius electron // Quantum re( ); // // // Bohr's radius // Quantum a0( ); // // // Solar radius // Quantum R0( ); // // // IAU Gaussian grav. const **2 // Quantum k2( ); // // // quarter turn = 90 degrees = pi/2 radians // Quantum qTurn( ); // // // half turn = 180 degrees = pi radians // Quantum hTurn( ); // // // full turn = 360 degrees = 2pi radians // Quantum fTurn( ); // // // // Physical constants should be known with their proper dimensions // // // // class QC { friend class QC_init; public: //# If you change any of the public data members, make the corresponding //# change above to the documentation of the public data members. // vel of light inline static const Quantum &c( ) { static Quantum result(C::c,"m/s"); return result; } // Gravitational constant inline static const Quantum &G( ) { static Quantum result(6.67259e-11,"N.m2/kg2"); return result; } // Planck inline static const Quantum &h( ) { static Quantum result(6.6260755e-34,"J.s"); return result; } // HI line inline static const Quantum &HI( ) { static Quantum result(1420.405751786, "MHz"); return result; } // Gas constant inline static Quantum &R( ) { static Quantum result(8.314510,"J/K/mol"); return result; } // Avogadro inline static const Quantum &NA( ) { static Quantum result(6.0221367e+23,"mol-1"); return result; } // electron charge inline static const Quantum &e( ) { static Quantum result(1.60217733e-19,"C"); return result; } // proton mass inline static const Quantum &mp( ) { static Quantum result(1.6726231e-27,"kg"); return result; } // mp/me inline static const Quantum &mp_me( ) { static Quantum result(1836.152701,""); return result; } // permeability vacuum inline static const Quantum &mu0( ) { static Quantum result(4.0e-7*C::pi,"H/m"); return result; } // permittivity vacuum inline static const Quantum &epsilon0( ) { static Quantum result(1.0/(4.0e-7*C::pi*C::c*C::c),"F/m"); return result; } // Boltzmann inline static const Quantum &k( ) { static Quantum result(8.314510/6.0221367e+23,"J/K"); return result; } // Faraday inline static const Quantum &F( ) { static Quantum result(6.0221367e+23*1.60217733e-19,"C/mol"); return result; } // mass electron inline static const Quantum &me( ) { static Quantum result(1.6726231e-27/1836.152701,"kg"); return result; } // radius electron inline static const Quantum &re( ) { static Quantum result(2.8179e-15,"m"); return result; } // Bohr's radius inline static const Quantum &a0( ) { static Quantum result(5.2918e-11,"m"); return result; } // Solar radius inline static const Quantum &R0( ) { static Quantum result(6.9599e+08,"m"); return result; } // IAU Gaussian grav. const **2 inline static const Quantum &k2( ) { const Double IAU_k=0.01720209895; static Quantum result(IAU_k*IAU_k,"AU3/d2/S0"); return result; } // quarter turn = 90 degrees = pi/2 radians inline static const Quantum &qTurn( ) { static Quantum result(90.0, "deg"); return result; } // half turn = 180 degrees = pi radians inline static const Quantum &hTurn( ) { static Quantum result(180.0, "deg"); return result; } // full turn = 360 degrees = 2pi radians inline static const Quantum &fTurn( ) { static Quantum result(360.0, "deg"); return result; } }; } //# NAMESPACE CASACORE - END #endif