UniformFieldI.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) 2013 OpenFOAM Foundation
9 Copyright (C) 2020 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
27\*---------------------------------------------------------------------------*/
28
29#include "UniformField.H"
30
31// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33namespace Foam
34{
35
36// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37
38template<class Type>
40(
41 const UniformField<Type>& a,
43)
44{
45 return UniformField<Type>(min(a.value(), b.value()));
46}
47
48
49template<class Type, class OtherType>
50inline OtherType min(const UniformField<Type>& u, const OtherType& o)
51{
52 return min(u.value(), o);
53}
54
55
56template<class Type, class OtherType>
57inline OtherType min(const OtherType& o, const UniformField<Type>& u)
58{
59 return min(o, u.value());
60}
61
62
63template<class Type>
65(
66 const UniformField<Type>& a,
68)
69{
70 return UniformField<Type>(max(a.value(), b.value()));
71}
72
73
74template<class Type, class OtherType>
75inline OtherType max(const UniformField<Type>& u, const OtherType& o)
76{
77 return max(u.value(), o);
78}
79
80
81template<class Type, class OtherType>
82inline OtherType max(const OtherType& o, const UniformField<Type>& u)
83{
84 return max(o, u.value());
85}
86
87
88// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89
90} // End namespace Foam
91
92// ************************************************************************* //
A class representing the concept of a uniform field which stores only the single value and providing ...
Definition: UniformField.H:54
const T & value() const noexcept
Return the value.
Definition: UniformList.H:81
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
volScalarField & b
Definition: createFields.H:27