chemmisol
0.1
Loading...
Searching...
No Matches
include
chemmisol
units.h
Go to the documentation of this file.
1
#ifndef CHEMMISOL_UNIT_H
2
#define CHEMMISOL_UNIT_H
3
13
#include <unordered_map>
14
#include <string>
15
98
#define UNITS(F)\
99
F(m, 1, LENGTH)\
100
F(cm, 1e-2*m, LENGTH)\
101
F(nm, 1e-9*m, LENGTH)\
102
F(nm2, nm*nm, SURFACE)\
103
F(m2, m*m, SURFACE)\
104
F(l, 1, VOLUME)\
105
F(m3, 1000*l, VOLUME)\
106
F(cm3, 10e-3*l, VOLUME)\
107
F(g, 1, MASS)\
108
F(gram, 1, MASS)\
109
F(kg, 1e3*gram, MASS)\
110
F(mg, 1e-3*gram, MASS)\
111
F(mol, 1, QUANTITY)\
112
F(entities, 1/NA, QUANTITY)\
113
F(u, 1.66053906660e-27*kg, MASS)
114
118
#define UNIT_DEF(NAME, VALUE, CATEGORY) extern const double NAME;
119
123
#define UNIT_VALUE(NAME, VALUE, CATEGORY) const double NAME = VALUE;
124
128
#define UNIT_NAME_TO_CATEGORY(NAME, VALUE, CATEGORY) {#NAME, Category::CATEGORY},
129
130
namespace
chemmisol
{
134
extern
const
double
NA
;
135
139
enum
Category
{
140
MASS, LENGTH, VOLUME, SURFACE, QUANTITY
141
};
142
143
UNITS
(
UNIT_DEF
)
144
static
const
std::unordered_map<std::string, Category> units_category {
145
UNITS
(
UNIT_NAME_TO_CATEGORY
)
146
};
147
}
148
#endif
chemmisol
Definition
chemmisol.h:31
chemmisol::Category
Category
Definition
units.h:139
chemmisol::NA
const double NA
UNIT_DEF
#define UNIT_DEF(NAME, VALUE, CATEGORY)
Definition
units.h:118
UNIT_NAME_TO_CATEGORY
#define UNIT_NAME_TO_CATEGORY(NAME, VALUE, CATEGORY)
Definition
units.h:128
UNITS
#define UNITS(F)
Defines available units.
Definition
units.h:98
Generated by
1.9.8