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