Loading...
Searching...
No Matches
labelSpecific.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2014-2017 OpenFOAM Foundation
9 Copyright (C) 2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Typedef
28 Foam::label
29
30Description
31 label specific functions for which there is no uLabel equivalent
32
33\*---------------------------------------------------------------------------*/
34
35// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36
37namespace Foam
38{
40// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41
42//- Return 1 if s is greater_equal zero, or otherwise -1
43inline label sign(const label s) noexcept
44{
45 return (s >= 0)? 1: -1;
46}
47
49//- Return 1 if s is greater_equal zero, or otherwise 0
50inline label pos0(const label s) noexcept
51{
52 return (s >= 0)? 1: 0;
53}
54
55
56//- Return 1 if s is less than zero, or otherwise 0
57inline label neg(const label s) noexcept
58{
59 return (s < 0)? 1: 0;
60}
61
62
63//- Return 1 if s is less_equal zero, or otherwise 0
64inline label neg0(const label s) noexcept
65{
66 return (s <= 0)? 1: 0;
67}
68
69
70//- Return the positive part of s, otherwise zero. Same as max(0, s).
71inline label posPart(const label s) noexcept
72{
73 return (s > 0)? s: 0;
74}
76
77//- Return the negative part of s, otherwise zero. Same as min(0, s).
78// Does not change the sign
79inline label negPart(const label s) noexcept
80{
81 return (s < 0)? s: 0;
82}
83
84
85// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87} // End namespace Foam
88
89// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
dimensionedScalar pos0(const dimensionedScalar &ds)
dimensionedScalar sign(const dimensionedScalar &ds)
dimensionedScalar negPart(const dimensionedScalar &ds)
dimensionedScalar neg(const dimensionedScalar &ds)
dimensionedScalar neg0(const dimensionedScalar &ds)
dimensionedScalar posPart(const dimensionedScalar &ds)