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 -------------------------------------------------------------------------------
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 "UniformField.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 template<class Type>
33 inline Foam::UniformField<Type>::UniformField(const Type& value)
34 :
35  value_(value)
36 {}
37 
38 
39 template<class Type>
41 {
42  return value_;
43 }
44 
45 
46 template<class Type>
48 {
49  return value_;
50 }
51 
52 
53 template<class Type>
55 {
56  return UniformField(value_);
57 }
58 
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 template<class Type>
69 (
70  const UniformField<Type>& u1,
71  const UniformField<Type>& u2
72 )
73 {
74  return UniformField<Type>(min(u1.operator Type(), u2.operator Type()));
75 }
76 
77 
78 template<class Type, class OtherType>
79 inline OtherType min(const UniformField<Type>& u, const OtherType& o)
80 {
81  return min(u.operator Type(), o);
82 }
83 
84 
85 template<class Type, class OtherType>
86 inline OtherType min(const OtherType& o, const UniformField<Type>& u)
87 {
88  return min(o, u.operator Type());
89 }
90 
91 
92 template<class Type>
93 inline UniformField<Type> max
94 (
95  const UniformField<Type>& u1,
96  const UniformField<Type>& u2
97 )
98 {
99  return UniformField<Type>(max(u1.operator Type(), u2.operator Type()));
100 }
101 
102 
103 template<class Type, class OtherType>
104 inline OtherType max(const UniformField<Type>& u, const OtherType& o)
105 {
106  return max(u.operator Type(), o);
107 }
108 
109 
110 template<class Type, class OtherType>
111 inline OtherType max(const OtherType& o, const UniformField<Type>& u)
112 {
113  return max(o, u.operator Type());
114 }
115 
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace Foam
120 
121 // ************************************************************************* //
Foam::UniformField::UniformField
UniformField(const Type &value)
Construct given value.
Definition: UniformFieldI.H:33
Foam::UniformField::operator[]
Type operator[](const label) const
Definition: UniformFieldI.H:47
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::UniformField
A class representing the concept of a uniform field which stores only the single value and providing ...
Definition: UniformField.H:49
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UniformField::field
UniformField field() const
Definition: UniformFieldI.H:54
UniformField.H