1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A uLabel is an unsigned label.
33 \*---------------------------------------------------------------------------*/
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 # define FOAM_ULABEL_MAX 18000000000000000000
47 # define FOAM_ULABEL_MAX 4000000000
51 #if UINT_MAX > FOAM_ULABEL_MAX
53 // Define uLabel as an unsigned int
55 # undef FOAM_ULABEL_MAX
56 # define FOAM_ULABEL_MAX UINT_MAX
62 typedef unsigned int uLabel;
64 static const uLabel uLabelMin = 0;
65 static const uLabel uLabelMax = UINT_MAX;
67 inline uLabel readULabel(Istream& is)
72 } // End namespace Foam
75 #elif ULONG_MAX > FOAM_ULABEL_MAX
77 // Define uLabel as an unsigned long
79 # undef FOAM_ULABEL_MAX
80 # define FOAM_ULABEL_MAX ULONG_MAX
87 typedef unsigned long uLabel;
89 static const uLabel uLabelMin = 0;
90 static const uLabel uLabelMax = ULONG_MAX;
92 inline uLabel readULabel(Istream& is)
97 } // End namespace Foam
100 #elif ULLONG_MAX > FOAM_ULABEL_MAX
102 // Define uLabel as an unsigned long long
104 # undef FOAM_ULABEL_MAX
106 # error "Not implemented yet"
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 #include "direction.H"
119 //- template specialization for pTraits<uLabel>
121 class pTraits<uLabel>
128 typedef uLabel cmptType;
134 dim = 3, // Dimensionality of space
135 rank = 0, // Rank of uLabel is 0
136 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;
152 //- Construct from uLabel
153 pTraits(const uLabel ul)
158 //- Construct from Istream
164 operator uLabel() const
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 inline uLabel& setComponent(uLabel& l, const direction)
183 inline uLabel component(const uLabel l, const direction)
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 } // End namespace Foam
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 // ************************************************************************* //