1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 A uLabel is an unsigned label.
34 \*---------------------------------------------------------------------------*/
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 # define FOAM_ULABEL_MAX 18000000000000000000
48 # define FOAM_ULABEL_MAX 4000000000
52 #if UINT_MAX > FOAM_ULABEL_MAX
54 // Define uLabel as an unsigned int
56 # undef FOAM_ULABEL_MAX
57 # define FOAM_ULABEL_MAX UINT_MAX
63 typedef unsigned int uLabel;
65 static const uLabel uLabelMin = 0;
66 static const uLabel uLabelMax = UINT_MAX;
68 inline uLabel readULabel(Istream& is)
73 } // End namespace Foam
76 #elif ULONG_MAX > FOAM_ULABEL_MAX
78 // Define uLabel as an unsigned long
80 # undef FOAM_ULABEL_MAX
81 # define FOAM_ULABEL_MAX ULONG_MAX
88 typedef unsigned long uLabel;
90 static const uLabel uLabelMin = 0;
91 static const uLabel uLabelMax = ULONG_MAX;
93 inline uLabel readULabel(Istream& is)
98 } // End namespace Foam
101 #elif ULLONG_MAX > FOAM_ULABEL_MAX
103 // Define uLabel as an unsigned long long
105 # undef FOAM_ULABEL_MAX
107 # error "Not implemented yet"
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 #include "direction.H"
120 //- template specialization for pTraits<uLabel>
122 class pTraits<uLabel>
129 typedef uLabel cmptType;
135 dim = 3, // Dimensionality of space
136 rank = 0, // Rank of uLabel is 0
137 nComponents = 1 // Number of components in uLabel is 1
140 // Static data members
142 static const char* const typeName;
143 static const char* componentNames[];
144 static const uLabel zero;
145 static const uLabel one;
146 static const uLabel max;
147 static const uLabel min;
151 //- Construct from Istream
157 operator uLabel() const
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 inline uLabel& setComponent(uLabel& l, const direction)
171 inline uLabel component(const uLabel l, const direction)
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 } // End namespace Foam
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 // ************************************************************************* //