Label

From OpenFOAMWiki
Revision as of 13:21, 6 July 2014 by Timofeymukha (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Variable type label is defined in OpenFOAM for storing integer data. It is widely used throughout OpenFOAM's source code wherever one might commonly expect an int.

Since the C++ standard does not define the sizes of variable types in bytes, the maximum value an int and other built-in integer types can take is not strictly defined by the language. OpenFOAM defines the maximum size of label to be at least 2e+9 or 9e+18 depending on whether a 32 or a 64 bit machine is used. This is implemented by looking at the maximum values of int, long and long long on the current machine and using typedef to define label as a type capable to fit the desired range of values.