zeroI.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) 2011-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 "zero.H"
27 #include "scalar.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 inline zero operator+(const zero&, const zero&)
37 {
38  return Zero;
39 }
40 
41 template<class Type>
42 inline const Type& operator+(const Type& t, const zero&)
43 {
44  return t;
45 }
46 
47 template<class Type>
48 inline const Type& operator+(const zero&, const Type& t)
49 {
50  return t;
51 }
52 
53 inline zero operator-(const zero&, const zero&)
54 {
55  return Zero;
56 }
57 
58 template<class Type>
59 inline const Type& operator-(const Type& t, const zero&)
60 {
61  return t;
62 }
63 
64 template<class Type>
65 inline Type operator-(const zero&, const Type& t)
66 {
67  return -t;
68 }
69 
70 inline zero operator*(const zero&, const zero&)
71 {
72  return Zero;
73 }
74 
75 template<class Type>
76 inline zero operator*(const Type& t, const zero&)
77 {
78  return Zero;
79 }
80 
81 template<class Type>
82 inline zero operator*(const zero&, const Type& t)
83 {
84  return Zero;
85 }
86 
87 template<class Type>
88 inline zero operator/(const zero&, const Type& t)
89 {
90  return Zero;
91 }
92 
93 inline zero min(const zero&, const zero&)
94 {
95  return Zero;
96 }
97 
98 template<class Type>
99 inline Type min(const zero&, const Type& t)
100 {
101  return min(scalar(0), t);
102 }
103 
104 template<class Type>
105 inline Type min(const Type& t, const zero&)
106 {
107  return min(t, scalar(0));
108 }
109 
110 inline zero max(const zero&, const zero&)
111 {
112  return Zero;
113 }
114 
115 template<class Type>
116 inline Type max(const zero&, const Type& t)
117 {
118  return max(scalar(0), t);
119 }
120 
121 template<class Type>
122 inline Type max(const Type& t, const zero&)
123 {
124  return max(t, scalar(0));
125 }
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // ************************************************************************* //
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
tmp< fvMatrix< Type > > operator*(const volScalarField::Internal &, const fvMatrix< Type > &)
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
static const zero Zero
Definition: zero.H:97
tmp< fvMatrix< Type > > operator+(const fvMatrix< Type > &, const fvMatrix< Type > &)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
Namespace for OpenFOAM.