OpenFOAM: API Guide
v2112
The open source CFD toolbox
uLabel.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | www.openfoam.com
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
Copyright (C) 2011-2016 OpenFOAM Foundation
9
-------------------------------------------------------------------------------
10
License
11
This file is part of OpenFOAM.
12
13
OpenFOAM is free software: you can redistribute it and/or modify it
14
under the terms of the GNU General Public License as published by
15
the Free Software Foundation, either version 3 of the License, or
16
(at your option) any later version.
17
18
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21
for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26
\*---------------------------------------------------------------------------*/
27
28
#include "
error.H
"
29
#include "
uLabel.H
"
30
31
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33
#if WM_LABEL_SIZE == 32
34
const
char
*
const
Foam::pTraits<uint64_t>::typeName
=
"uint64"
;
35
const
char
*
const
Foam::pTraits<uint32_t>::typeName
=
"uLabel"
;
36
#elif WM_LABEL_SIZE == 64
37
const
char
*
const
Foam::pTraits<uint64_t>::typeName
=
"uLabel"
;
38
const
char
*
const
Foam::pTraits<uint32_t>::typeName
=
"uint32"
;
39
#endif
40
41
42
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44
Foam::uLabel
Foam::pow
(uLabel a, uLabel
b
)
45
{
46
uLabel ans = 1;
47
for
(uLabel i=0; i<
b
; i++)
48
{
49
ans *= a;
50
}
51
52
return
ans;
53
}
54
55
56
Foam::uLabel
Foam::factorial
(uLabel
n
)
57
{
58
static
uLabel factTable[13] =
59
{
60
1, 1, 2, 6, 24, 120, 720, 5040, 40320,
61
362880, 3628800, 39916800, 479001600
62
};
63
64
#ifdef FULLDEBUG
65
if
(
n
> 12)
66
{
67
FatalErrorInFunction
68
<<
"n value out of range (> 12)"
69
<<
abort
(
FatalError
);
70
}
71
#endif
72
73
return
factTable[
n
];
74
}
75
76
77
// ************************************************************************* //
n
label n
Definition:
TABSMDCalcMethod2.H:31
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition:
createFields.H:27
error.H
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition:
dimensionedScalar.C:75
Foam::FatalError
error FatalError
Foam::abort
errorManip< error > abort(error &err)
Definition:
errorManip.H:144
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition:
error.H:453
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition:
pTraits.H:56
Foam::factorial
label factorial(label n)
Evaluate n! : 0 < n <= 12.
Definition:
label.C:145
uLabel.H
src
OpenFOAM
primitives
ints
uLabel
uLabel.C
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.