uLabel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Typedef
25  Foam::uLabel
26 
27 Description
28  A uLabel is an uint32_t or uint64_t as specified by the pre-processor macro
29  WM_LABEL_SIZE.
30 
31  A readLabel function is defined so that uLabel can be constructed from
32  Istream.
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef uLabel_H
37 #define uLabel_H
38 
39 #include "uint.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 #define UINT_ADD_SIZE(x,s,y) x ## s ## y
44 #define UINT_ADD_DEF_SIZE(x,s,y) UINT_ADD_SIZE(x,s,y)
45 #define UINT_SIZE(x,y) UINT_ADD_DEF_SIZE(x,WM_LABEL_SIZE,y)
46 
47 #if WM_LABEL_SIZE != 32 && WM_LABEL_SIZE != 64
48  #error "uLabel.H: WM_LABEL_SIZE must be set to either 32 or 64"
49 #endif
50 
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 typedef UINT_SIZE(uint, _t) uLabel;
60 
61 static const uLabel uLabelMin = UINT_SIZE(UINT, _MIN);
62 static const uLabel uLabelMax = UINT_SIZE(UINT, _MAX);
63 
65 {
66  return UINT_SIZE(readUint,) (is);
67 }
68 
69 
70 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 
72 //- Raise one uLabel to the power of another
74 
75 //- Evaluate n! : 0 < n <= 12
77 
78 
79 inline uLabel& setComponent(uLabel& l, const direction)
80 {
81  return l;
82 }
83 
84 inline uLabel component(const uLabel l, const direction)
85 {
86  return l;
87 }
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 } // End namespace Foam
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 #include "uLabelSpecific.H"
96 
97 #undef UINT_ADD_SIZE
98 #undef UINT_ADD_DEF_SIZE
99 #undef UINT_SIZE
100 
101 #endif
102 
103 // ************************************************************************* //
Foam::setComponent
label & setComponent(label &l, const direction)
Definition: label.H:79
Foam::component
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Definition: FieldFieldFunctions.C:41
Foam::uLabelMax
static const uLabel uLabelMax
Definition: uLabel.H:62
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::readUint
uint readUint(Istream &)
Definition: uintIO.C:31
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:28
Foam::uLabelMin
static const uLabel uLabelMin
Definition: uLabel.H:61
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
uLabelSpecific.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
uint.H
System uinteger.
UINT_SIZE
#define UINT_SIZE(x, y)
Definition: uLabel.H:45
Foam::readULabel
uLabel readULabel(Istream &is)
Definition: uLabel.H:64
Foam::direction
unsigned char direction
Definition: direction.H:43
Foam::factorial
label factorial(label n)
Evaluate n! : 0 < n <= 12.
Definition: label.C:63
Foam::uLabel
uintWM_LABEL_SIZE_t uLabel
A uLabel is an uint32_t or uint64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: uLabel.H:59