OpenStructure
units.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
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 FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_UNITS_HH
20 #define OST_UNITS_HH
21 
22 #include <ost/module_config.hh>
23 
24 /*
25  convenience struct for units
26 
27  Author: Ansgar Philippsen
28 */
29 
30 namespace ost {
31 
43 #ifdef _MSC_VER
44 namespace Units {
45 const Real m=1.0e10;
46 const Real cm=1.0e8;
47 const Real mm=1.0e7;
48 const Real um=1.0e4;
49 const Real nm=1.0e1;
50 const Real pm=1.0e-2;
51 const Real A=1.0;
52 
53 const Real in=2.54e8;
54 const Real ft=3.048e9;
55 const Real yd=9.144e9;
56 
57 // standard angular unit is radians
58 const Real deg=0.0174532925199;
59 const Real rad=1.0;
60 const Real mrad=1.0e-3;
61 
62 // energy units converted according to metric units
63 const Real J=1.0e20;
64 const Real eV=16.0217653;
65 
66 
67 // converted according to metric units
68 const Real V=1.0e20;
69 const Real kV=1.0e23;
70 
71 // time units
72 const Real s=1.0;
73 const Real min=60.0;
74 const Real h=3600.0;
75 
76 //mass units
77 const Real kg=1.0;
78 const Real g=1.0e-3;
79 const Real mg=1.0e-6;
80 const Real kDa=1.6605655e-24;
81 const Real Da=1.6605655e-27;
82 
83 //charge
84 const Real C=1.0;
85 
86 } // Units
87 
88 #else
89 
91  static const Real m;
92  static const Real cm;
93  static const Real mm;
94  static const Real um;
95  static const Real nm;
96  static const Real pm;
97  static const Real A;
98 
99  static const Real in;
100  static const Real ft;
101  static const Real yd;
102 
103  static const Real deg;
104  static const Real rad;
105  static const Real mrad;
106 
107  static const Real J;
108  static const Real eV;
109 
110  static const Real V;
111  static const Real kV;
112 
113  static const Real s;
114  static const Real min;
115  static const Real h;
116 
117  static const Real kg;
118  static const Real g;
119  static const Real mg;
120  static const Real kDa;
121  static const Real Da;
122 
123  static const Real C;
124 };
125 
126 #endif
127 
128 } // ns
129 
130 
131 
132 
133 
134 
135 
136 #endif // OST_UNITS_HH