chemmisol 0.1
Loading...
Searching...
No Matches
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
130namespace chemmisol {
134 extern const double NA;
135
139 enum Category {
140 MASS, LENGTH, VOLUME, SURFACE, QUANTITY
141 };
142
144 static const std::unordered_map<std::string, Category> units_category {
146 };
147}
148#endif
Definition chemmisol.h:31
Category
Definition units.h:139
const double NA
#define UNIT_DEF(NAME, VALUE, CATEGORY)
Definition units.h:118
#define UNIT_NAME_TO_CATEGORY(NAME, VALUE, CATEGORY)
Definition units.h:128
#define UNITS(F)
Defines available units.
Definition units.h:98