oneI.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 "scalar.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 template<class arg2>
39 class innerProduct<one, arg2>
40 {
41 public:
42 
43  typedef arg2 type;
44 };
45 
46 inline scalar operator+(const scalar& t, const one&) noexcept
47 {
48  return t + 1;
49 }
50 
51 inline scalar operator+(const one&, const scalar& t) noexcept
52 {
53  return 1 + t;
54 }
55 
56 inline scalar operator-(const scalar& t, const one&) noexcept
57 {
58  return t - 1;
59 }
60 
61 inline scalar operator-(const one&, const scalar& t) noexcept
62 {
63  return 1 - t;
64 }
65 
66 inline constexpr const one& operator*(const one& o, const one&) noexcept
67 {
68  return o;
69 }
70 
71 template<class Type>
72 inline constexpr const Type& operator*(const Type& val, const one&) noexcept
73 {
74  return val;
75 }
76 
77 template<class Type>
78 inline constexpr const Type& operator*(const one&, const Type& val) noexcept
79 {
80  return val;
81 }
82 
83 template<class Type>
84 inline constexpr const Type& operator&(const one&, const Type& val) noexcept
85 {
86  return val;
87 }
88 
89 inline constexpr const one& operator/(const one& o, const one&) noexcept
90 {
91  return o;
92 }
93 
94 template<class Type>
95 inline Type operator/(const one&, const Type& val)
96 {
97  return scalar(1)/val;
98 }
99 
100 template<class Type>
101 inline constexpr const Type& operator/(const Type& val, const one&) noexcept
102 {
103  return val;
104 }
105 
106 inline constexpr const one& min(const one& o, const one&) noexcept
107 {
108  return o;
109 }
110 
111 template<class Type>
112 inline Type min(const one&, const Type& t) noexcept
113 {
114  return min(scalar(1), t);
115 }
116 
117 template<class Type>
118 inline Type min(const Type& t, const one&) noexcept
119 {
120  return min(t, scalar(1));
121 }
122 
123 inline constexpr const one& max(const one& o, const one&) noexcept
124 {
125  return o;
126 }
127 
128 template<class Type>
129 inline Type max(const one&, const Type& t) noexcept
130 {
131  return max(scalar(1), t);
132 }
133 
134 template<class Type>
135 inline Type max(const Type& t, const one&) noexcept
136 {
137  return max(t, scalar(1));
138 }
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace Foam
143 
144 // ************************************************************************* //
Foam::operator&
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Foam::innerProduct
Definition: products.H:141
Foam::operator-
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Foam::one
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:61
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::innerProduct< one, arg2 >::type
arg2 type
Definition: oneI.H:43
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
scalar.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::operator/
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
Definition: dimensionedScalar.C:68
Foam::operator+
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::operator*
tmp< faMatrix< Type > > operator*(const areaScalarField &, const faMatrix< Type > &)