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/>.
24 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 const char* const pTraits<label>::typeName = "label";
37 const label pTraits<label>::zero = 0;
38 const label pTraits<label>::one = 1;
39 const label pTraits<label>::min = labelMin;
40 const label pTraits<label>::max = labelMax;
42 const char* pTraits<label>::componentNames[] = { "x" };
44 pTraits<label>::pTraits(Istream& is)
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 // Raise one label to the power of another (overloaded function call)
53 label pow(label a, label b)
55 register label ans = 1;
56 for (register label i=0; i<b; i++)
64 FatalErrorIn("pow(label a, label b)")
65 << "negative value for b is not supported"
74 //- Return factorial(n) : 0 <= n <= 12
75 label factorial(label n)
77 static label factTable[13] =
79 1, 1, 2, 6, 24, 120, 720, 5040, 40320,
80 362880, 3628800, 39916800, 479001600
86 FatalErrorIn("factorial(label n)")
87 << "n value out of range"
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 } // End namespace Foam
100 // ************************************************************************* //