zero.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-2020 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 Class
25  Foam::zero
26 
27 Description
28  A class representing the concept of 0 used to avoid unnecessary
29  manipulations for objects that are known to be zero at compile-time.
30 
31 SourceFiles
32  zeroI.H
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef zero_H
37 #define zero_H
38 
39 #include "label.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class zero Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class zero
51 {
52 public:
53 
54  typedef zero value_type;
55 
56  // Constructors
57 
58  //- Construct null
59  zero()
60  {}
61 
62 
63  // Member Operators
64 
65  //- Return 0 for bool
66  inline operator bool() const
67  {
68  return 0;
69  }
70 
71  //- Return 0 for label
72  inline operator label() const
73  {
74  return 0;
75  }
76 
77  //- Return 0 for float
78  inline operator float() const
79  {
80  return 0;
81  }
82 
83  //- Return 0 for double
84  inline operator double() const
85  {
86  return 0;
87  }
88 
89  //- Return 0 for double
90  inline operator long double() const
91  {
92  return 0;
93  }
94 };
95 
96 
97 // Global zero
98 static const zero Zero;
99 
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 } // End namespace Foam
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 #include "zeroI.H"
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 #endif
112 
113 // ************************************************************************* //
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static const zero Zero
Definition: zero.H:97
zero value_type
Definition: zero.H:53
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
zero()
Construct null.
Definition: zero.H:58
FvWallInfoData< WallInfo, bool > bool
Namespace for OpenFOAM.