File indexing completed on 2024-05-19 15:01:38
0001 /*************************************************************************** 0002 File : constants.h 0003 Project : LabPlot 0004 Description : definition of mathematical and physical constants 0005 -------------------------------------------------------------------- 0006 Copyright : (C) 2014 by Alexander Semke (alexander.semke@web.de) 0007 Copyright : (C) 2014-2018 by Stefan Gerlach (stefan.gerlach@uni.kn) 0008 0009 ***************************************************************************/ 0010 0011 /*************************************************************************** 0012 * * 0013 * This program is free software; you can redistribute it and/or modify * 0014 * it under the terms of the GNU General Public License as published by * 0015 * the Free Software Foundation; either version 2 of the License, or * 0016 * (at your option) any later version. * 0017 * * 0018 * This program is distributed in the hope that it will be useful, * 0019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0021 * GNU General Public License for more details. * 0022 * * 0023 * You should have received a copy of the GNU General Public License * 0024 * along with this program; if not, write to the Free Software * 0025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0026 * Boston, MA 02110-1301 USA * 0027 * * 0028 ***************************************************************************/ 0029 0030 #ifndef GSL_CONSTANTS_H 0031 #define GSL_CONSTANTS_H 0032 0033 #include <gsl/gsl_math.h> 0034 #include <gsl/gsl_const_mksa.h> 0035 #include <gsl/gsl_const_num.h> 0036 0037 #include "parser.h" 0038 0039 /* sync with ExpressionParser.cpp */ 0040 struct cons _constants[] = { 0041 /* Mathematical constants */ 0042 {"e", M_E}, 0043 {"pi", M_PI}, 0044 {"euler", M_EULER}, 0045 0046 /* Physical constants: https://www.gnu.org/software/gsl/doc/html/const.html */ 0047 /* Physical constants in MKSA system */ 0048 0049 /* Fundamental Constants */ 0050 {"cL", GSL_CONST_MKSA_SPEED_OF_LIGHT}, 0051 {"mu0", GSL_CONST_MKSA_VACUUM_PERMEABILITY}, 0052 {"e0", GSL_CONST_MKSA_VACUUM_PERMITTIVITY}, 0053 {"hPlanck", GSL_CONST_MKSA_PLANCKS_CONSTANT_H}, 0054 {"hbar", GSL_CONST_MKSA_PLANCKS_CONSTANT_HBAR}, 0055 {"NA", GSL_CONST_NUM_AVOGADRO}, 0056 {"Faraday", GSL_CONST_MKSA_FARADAY}, 0057 {"kB", GSL_CONST_MKSA_BOLTZMANN}, 0058 {"r0", GSL_CONST_MKSA_MOLAR_GAS}, 0059 {"v0", GSL_CONST_MKSA_STANDARD_GAS_VOLUME}, 0060 {"sigma", GSL_CONST_MKSA_STEFAN_BOLTZMANN_CONSTANT}, 0061 {"Gauss", GSL_CONST_MKSA_GAUSS}, 0062 0063 /* Astronomy and Astrophysics */ 0064 {"au", GSL_CONST_MKSA_ASTRONOMICAL_UNIT}, 0065 {"G", GSL_CONST_MKSA_GRAVITATIONAL_CONSTANT}, 0066 {"ly", GSL_CONST_MKSA_LIGHT_YEAR}, 0067 {"pc", GSL_CONST_MKSA_PARSEC}, 0068 {"gg", GSL_CONST_MKSA_GRAV_ACCEL}, 0069 {"ms", GSL_CONST_MKSA_SOLAR_MASS}, 0070 0071 /* Atomic and Nuclear Physics */ 0072 {"ee", GSL_CONST_MKSA_ELECTRON_CHARGE}, 0073 {"ev", GSL_CONST_MKSA_ELECTRON_VOLT}, 0074 {"amu", GSL_CONST_MKSA_UNIFIED_ATOMIC_MASS}, 0075 {"me", GSL_CONST_MKSA_MASS_ELECTRON}, 0076 {"mmu", GSL_CONST_MKSA_MASS_MUON}, 0077 {"mp", GSL_CONST_MKSA_MASS_PROTON}, 0078 {"mn", GSL_CONST_MKSA_MASS_NEUTRON}, 0079 {"alpha", GSL_CONST_NUM_FINE_STRUCTURE}, 0080 {"Ry", GSL_CONST_MKSA_RYDBERG}, 0081 {"aB", GSL_CONST_MKSA_BOHR_RADIUS}, 0082 {"ao", GSL_CONST_MKSA_ANGSTROM}, 0083 {"barn", GSL_CONST_MKSA_BARN}, 0084 {"muB", GSL_CONST_MKSA_BOHR_MAGNETON}, 0085 {"mun", GSL_CONST_MKSA_NUCLEAR_MAGNETON}, 0086 {"mue", GSL_CONST_MKSA_ELECTRON_MAGNETIC_MOMENT}, 0087 {"mup", GSL_CONST_MKSA_PROTON_MAGNETIC_MOMENT}, 0088 {"sigmaT", GSL_CONST_MKSA_THOMSON_CROSS_SECTION}, 0089 {"pD", GSL_CONST_MKSA_DEBYE}, 0090 0091 /* Measurement of Time */ 0092 {"min", GSL_CONST_MKSA_MINUTE}, 0093 {"hour", GSL_CONST_MKSA_HOUR}, 0094 {"day", GSL_CONST_MKSA_DAY}, 0095 {"week", GSL_CONST_MKSA_WEEK}, 0096 0097 /* Imperial Units */ 0098 {"in", GSL_CONST_MKSA_INCH}, 0099 {"ft", GSL_CONST_MKSA_FOOT}, 0100 {"yard", GSL_CONST_MKSA_YARD}, 0101 {"mile", GSL_CONST_MKSA_MILE}, 0102 {"mil", GSL_CONST_MKSA_MIL}, 0103 0104 /* Speed and Nautical Units */ 0105 {"v_km_per_h", GSL_CONST_MKSA_KILOMETERS_PER_HOUR}, 0106 {"v_mile_per_h", GSL_CONST_MKSA_MILES_PER_HOUR}, 0107 {"nmile", GSL_CONST_MKSA_NAUTICAL_MILE}, 0108 {"fathom", GSL_CONST_MKSA_FATHOM}, 0109 {"knot", GSL_CONST_MKSA_KNOT}, 0110 0111 /* Printers Units */ 0112 {"pt", GSL_CONST_MKSA_POINT}, 0113 {"texpt", GSL_CONST_MKSA_TEXPOINT}, 0114 0115 /* Volume, Area and Length */ 0116 {"micron", GSL_CONST_MKSA_MICRON}, 0117 {"hectare", GSL_CONST_MKSA_HECTARE}, 0118 {"acre", GSL_CONST_MKSA_ACRE}, 0119 {"liter", GSL_CONST_MKSA_LITER}, 0120 {"us_gallon", GSL_CONST_MKSA_US_GALLON}, 0121 {"can_gallon", GSL_CONST_MKSA_CANADIAN_GALLON}, 0122 {"uk_gallon", GSL_CONST_MKSA_UK_GALLON}, 0123 {"quart", GSL_CONST_MKSA_QUART}, 0124 {"pint", GSL_CONST_MKSA_PINT}, 0125 0126 /* Mass and Weight */ 0127 {"pound", GSL_CONST_MKSA_POUND_MASS}, 0128 {"ounce", GSL_CONST_MKSA_OUNCE_MASS}, 0129 {"ton", GSL_CONST_MKSA_TON}, 0130 {"mton", GSL_CONST_MKSA_METRIC_TON}, 0131 {"uk_ton", GSL_CONST_MKSA_UK_TON}, 0132 {"troy_ounce", GSL_CONST_MKSA_TROY_OUNCE}, 0133 {"carat", GSL_CONST_MKSA_CARAT}, 0134 {"gram_force", GSL_CONST_MKSA_GRAM_FORCE}, 0135 {"pound_force", GSL_CONST_MKSA_POUND_FORCE}, 0136 {"kilepound_force", GSL_CONST_MKSA_KILOPOUND_FORCE}, 0137 {"poundal", GSL_CONST_MKSA_POUNDAL}, 0138 0139 /* Thermal Energy and Power */ 0140 {"cal", GSL_CONST_MKSA_CALORIE}, 0141 {"btu", GSL_CONST_MKSA_BTU}, 0142 {"therm", GSL_CONST_MKSA_THERM}, 0143 {"hp", GSL_CONST_MKSA_HORSEPOWER}, 0144 0145 /* Pressure */ 0146 {"bar", GSL_CONST_MKSA_BAR}, 0147 {"atm", GSL_CONST_MKSA_STD_ATMOSPHERE}, 0148 {"torr", GSL_CONST_MKSA_TORR}, 0149 {"mhg", GSL_CONST_MKSA_METER_OF_MERCURY}, 0150 {"inhg", GSL_CONST_MKSA_INCH_OF_MERCURY}, 0151 {"inh2o", GSL_CONST_MKSA_INCH_OF_WATER}, 0152 {"psi", GSL_CONST_MKSA_PSI}, 0153 0154 /* Viscosity */ 0155 {"poise", GSL_CONST_MKSA_POISE}, 0156 {"stokes", GSL_CONST_MKSA_STOKES}, 0157 0158 /* Light and Illumination */ 0159 {"stilb", GSL_CONST_MKSA_STILB}, 0160 {"lumen", GSL_CONST_MKSA_LUMEN}, 0161 {"lux", GSL_CONST_MKSA_LUX}, 0162 {"phot", GSL_CONST_MKSA_PHOT}, 0163 {"ftcandle", GSL_CONST_MKSA_FOOTCANDLE}, 0164 {"lambert", GSL_CONST_MKSA_LAMBERT}, 0165 {"ftlambert", GSL_CONST_MKSA_FOOTLAMBERT}, 0166 0167 /* Radioactivity */ 0168 {"Curie", GSL_CONST_MKSA_CURIE}, 0169 {"Roentgen", GSL_CONST_MKSA_ROENTGEN}, 0170 {"rad", GSL_CONST_MKSA_RAD}, 0171 0172 /* Force and Energy */ 0173 {"Newton", GSL_CONST_MKSA_NEWTON}, 0174 {"dyne", GSL_CONST_MKSA_DYNE}, 0175 {"Joule", GSL_CONST_MKSA_JOULE}, 0176 {"erg", GSL_CONST_MKSA_ERG}, 0177 0178 /* ignore '...' */ 0179 {"...", 0}, 0180 {0, 0} 0181 }; 0182 0183 #endif /* CONSTANTS_H */