antioch-0.4.0
List of all members | Public Member Functions | Private Attributes
Antioch::UnitBaseConstant::UnitBaseStore< T > Class Template Reference

#include <unit_store.h>

Public Member Functions

 ~UnitBaseStore ()
 
 UnitBaseStore ()
 
int stored_index (const std::string &symb) const
 
const UnitBase< T > stored (const int &iunit) const
 
int n_known_units () const
 

Private Attributes

std::map< std::string,
unsigned int > 
map_store
 
std::vector< UnitBase< T > > store
 
unsigned int _n_known_units
 

Detailed Description

template<typename T = double>
class Antioch::UnitBaseConstant::UnitBaseStore< T >

Definition at line 67 of file unit_store.h.

Constructor & Destructor Documentation

template<typename T = double>
Antioch::UnitBaseConstant::UnitBaseStore< T >::~UnitBaseStore ( )
inline

Definition at line 69 of file unit_store.h.

69 {}
template<typename T = double>
Antioch::UnitBaseConstant::UnitBaseStore< T >::UnitBaseStore ( )
inline

Definition at line 70 of file unit_store.h.

References Antioch::UnitBaseConstant::UnitBaseStore< T >::_n_known_units, std::int, Antioch::UnitBaseConstant::UnitBaseStore< T >::map_store, and Antioch::UnitBaseConstant::UnitBaseStore< T >::store.

71  {
72  /* base UnitBase,
73  * UnitBase<T>(string symbol, string name,
74  * double a, double b,
75  * int m, int kg = 0, int s = 0, int A = 0, int K = 0, int mol = 0, int cd = 0, int rad = 0)
76  */
77  store.push_back(UnitBase<T>("m", "meter", 1.0L,0.,1));
78  store.push_back(UnitBase<T>("kg", "kilogram",1.0L,0.,0,1));
79  store.push_back(UnitBase<T>("s", "second", 1.0L,0.,0,0,1));
80  store.push_back(UnitBase<T>("A", "ampere", 1.0L,0.,0,0,0,1));
81  store.push_back(UnitBase<T>("K", "kelvin", 1.0L,0.,0,0,0,0,1));
82  store.push_back(UnitBase<T>("mol","mole", 1.0L,0.,0,0,0,0,0,1));
83  store.push_back(UnitBase<T>("cd", "candela", 1.0L,0.,0,0,0,0,0,0,1));
84  store.push_back(UnitBase<T>("rad","radian", 1.0L,0.,0,0,0,0,0,0,0,1));
85  /* others known Units using constructor
86  * UnitBase<T>(string symbol, string name,
87  * double a, double b,
88  * int m, int kg=0, int s=0, int A=0, int K=0, int mol=0, int cd=0, int rad=0)
89  */
90  //length
91  store.push_back(UnitBase<T>("in", "inch", 0.0254L, 0.,1));
92  store.push_back(UnitBase<T>("ft", "foot", 0.3048L, 0.,1));
93  store.push_back(UnitBase<T>("ua", "astronomical unit",1.49597870700e11L,0.,1)); //~ Sun-Earth distance, BIPM symbol
94  store.push_back(UnitBase<T>("ang","angstrom", 1e-10L, 0.,1));
95  //mass
96  store.push_back(UnitBase<T>("Da","dalton", 1.660538921e-27L,0.,0,1));
97  store.push_back(UnitBase<T>("u", "unified atomic mass",1.660538921e-27L,0.,0,1));
98  //Time
99  store.push_back(UnitBase<T>("min", "minute",60.0L, 0.,0,0,1));
100  store.push_back(UnitBase<T>("hour","hour", 3600.0L,0.,0,0,1));
101  //Current
102  //Temperature
103  store.push_back(UnitBase<T>("degC","degree Celsius", 1.L, 273.15L, 0,0,0,0,1));
104  store.push_back(UnitBase<T>("degF","degree Farenheit",5.L/9.L,459.57L*5.0L/9.0L,0,0,0,0,1));
105  //angle
106  store.push_back(UnitBase<T>("deg", "degree", Constants::pi<T>()/180.0L, 0.,0,0,0,0,0,0,0,1));
107  store.push_back(UnitBase<T>("\'", "Arcminute", Constants::pi<T>()/(180.0L*60.0L), 0.,0,0,0,0,0,0,0,1));
108  store.push_back(UnitBase<T>("\'\'","Arcsecond", Constants::pi<T>()/(180.0L*60.0L*60.0L),0.,0,0,0,0,0,0,0,1));
109  //volume
110  store.push_back(UnitBase<T>("l","litre",1e-3L,0.,3));
111  store.push_back(UnitBase<T>("L","litre",1e-3L,0.,3));
112  //Force m.kg.s-2
113  store.push_back(UnitBase<T>("N", "newton",1.0L, 0.,1,1,-2));
114  store.push_back(UnitBase<T>("dyn","dyne", 1e-5L,0.,1,1,-2));
115  //Pressure N.m-2 (m-1.kg.s-2)
116  store.push_back(UnitBase<T>("Pa", "pascal", 1.0L, 0.,-1,1,-2));
117  store.push_back(UnitBase<T>("bar", "bar", 1e5L, 0.,-1,1,-2));
118  store.push_back(UnitBase<T>("at", "technical atmosphere", 9.80665e4L, 0.,-1,1,-2));
119  store.push_back(UnitBase<T>("atm", "atmosphere", 1.01325e5L, 0.,-1,1,-2));
120  store.push_back(UnitBase<T>("Torr","Torr", 101325.0L/760.0L,0.,-1,1,-2)); // 1 atm / 760 by def
121  store.push_back(UnitBase<T>("psi", "pound per square inch",6.895e3L, 0.,-1,1,-2));
122  store.push_back(UnitBase<T>("mmHg","millimeter of mercury",133.322387415L, 0.,-1,1,-2));
123  //viscosity Pa.s (m-1.kg.s-1)
124  store.push_back(UnitBase<T>("P","poise",0.1L,0.,-1,1,-1));
125  //Power W (m2.kg.s-3)
126  store.push_back(UnitBase<T>("W","watt" ,1.0L,0.,2 ,1,-3));
127  //Energy N.m (m2.kg.s-2)
128  store.push_back(UnitBase<T>("J", "joule", 1.0L, 0.,2,1,-2));
129  store.push_back(UnitBase<T>("cal", "calorie", 4.1868L, 0.,2,1,-2));//International table
130  store.push_back(UnitBase<T>("calth","calorie thermodynamic", 4.184L,0.,2,1,-2));//thermodynamics
131  store.push_back(UnitBase<T>("eV", "electronVolt",1.602176565e-19L,0.,2,1,-2));
132  store.push_back(UnitBase<T>("erg", "erg", 1.e-7L, 0.,2,1,-2));
133  store.push_back(UnitBase<T>("Ha", "hartree", 4.35974434e-18L, 0.,2,1,-2));
134  //Electric charge A.s
135  store.push_back(UnitBase<T>("C","coulomb",1.0L,0.,0,0,1,1));
136  //Frequency s-1
137  store.push_back(UnitBase<T>("Hz","herzt", 1.0L, 0.,0,0,-1));
138  store.push_back(UnitBase<T>("Ci","curie", 3.7e10L,0.,0,0,-1));
139  store.push_back(UnitBase<T>("Bq","becquerel",1.0L, 0.,0,0,-1));
140  // dipole moment C.m = A.s.m
141  store.push_back(UnitBase<T>("D","debye",3.335641e-30L,0.,1,0,1,1)); // http://cccbdb.nist.gov/debye.asp)
142  //no unit
143  store.push_back(UnitBase<T>("molecule","molecule",1.0L,0.,0,0,0,0,0,0));
144  store.push_back(UnitBase<T>("photon", "photon", 1.0L,0.,0,0,0,0,0,0));
145 
146  _n_known_units = store.size();
147 
148  for(int i = 0; i < (int)store.size(); i++)
149  {
150  map_store[store[i].symbol()] = i;
151  }
152  }
a int
Definition: eigen_utils.h:67
std::vector< UnitBase< T > > store
Definition: unit_store.h:172
std::map< std::string, unsigned int > map_store
Definition: unit_store.h:171

Member Function Documentation

template<typename T = double>
int Antioch::UnitBaseConstant::UnitBaseStore< T >::n_known_units ( ) const
inline

Definition at line 165 of file unit_store.h.

References Antioch::UnitBaseConstant::UnitBaseStore< T >::_n_known_units.

166  {
167  return _n_known_units;
168  }
template<typename T = double>
const UnitBase<T> Antioch::UnitBaseConstant::UnitBaseStore< T >::stored ( const int &  iunit) const
inline

Definition at line 160 of file unit_store.h.

References Antioch::UnitBaseConstant::UnitBaseStore< T >::store.

161  {
162  return store[iunit];
163  }
std::vector< UnitBase< T > > store
Definition: unit_store.h:172
template<typename T = double>
int Antioch::UnitBaseConstant::UnitBaseStore< T >::stored_index ( const std::string &  symb) const
inline

Definition at line 154 of file unit_store.h.

References Antioch::UnitBaseConstant::UnitBaseStore< T >::map_store.

155  {
156  return (symb == "g")?map_store.at("kg"): //special case for gram
157  (map_store.count(symb))?map_store.at(symb):-1;
158  }
std::map< std::string, unsigned int > map_store
Definition: unit_store.h:171

Member Data Documentation

template<typename T = double>
unsigned int Antioch::UnitBaseConstant::UnitBaseStore< T >::_n_known_units
private
template<typename T = double>
std::map<std::string,unsigned int> Antioch::UnitBaseConstant::UnitBaseStore< T >::map_store
private
template<typename T = double>
std::vector<UnitBase<T> > Antioch::UnitBaseConstant::UnitBaseStore< T >::store
private

The documentation for this class was generated from the following file:

Generated on Thu Jul 7 2016 11:09:50 for antioch-0.4.0 by  doxygen 1.8.8