UniformFieldI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "UniformField.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 template<class Type>
31 inline Foam::UniformField<Type>::UniformField(const Type& value)
32 :
33  value_(value)
34 {}
35 
36 
37 template<class Type>
39 {
40  return value_;
41 }
42 
43 
44 template<class Type>
46 {
47  return value_;
48 }
49 
50 
51 template<class Type>
53 {
54  return UniformField(value_);
55 }
56 
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 template<class Type>
67 (
68  const UniformField<Type>& u1,
69  const UniformField<Type>& u2
70 )
71 {
72  return UniformField<Type>(min(u1.operator Type(), u2.operator Type()));
73 }
74 
75 
76 template<class Type, class OtherType>
77 inline OtherType min(const UniformField<Type>& u, const OtherType& o)
78 {
79  return min(u.operator Type(), o);
80 }
81 
82 
83 template<class Type, class OtherType>
84 inline OtherType min(const OtherType& o, const UniformField<Type>& u)
85 {
86  return min(o, u.operator Type());
87 }
88 
89 
90 template<class Type>
92 (
93  const UniformField<Type>& u1,
94  const UniformField<Type>& u2
95 )
96 {
97  return UniformField<Type>(max(u1.operator Type(), u2.operator Type()));
98 }
99 
100 
101 template<class Type, class OtherType>
102 inline OtherType max(const UniformField<Type>& u, const OtherType& o)
103 {
104  return max(u.operator Type(), o);
105 }
106 
107 
108 template<class Type, class OtherType>
109 inline OtherType max(const OtherType& o, const UniformField<Type>& u)
110 {
111  return max(o, u.operator Type());
112 }
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // ************************************************************************* //
A class representing the concept of a uniform field which stores only the single value and providing ...
Definition: UniformField.H:47
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:59
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Type operator[](const label) const
Definition: UniformFieldI.H:45
UniformField field() const
Definition: UniformFieldI.H:52
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
UniformField(const Type &value)
Construct given value.
Definition: UniformFieldI.H:31
Namespace for OpenFOAM.