oneField.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) 2019 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 Class
28  Foam::oneField
29 
30 Description
31  A class representing the concept of a field of 1 used to avoid unnecessary
32  manipulations for objects which are known to be one at compile-time.
33 
34  Used for example as the density argument to a function written for
35  compressible to be used for incompressible flow.
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef oneField_H
40 #define oneField_H
41 
42 #include "one.H"
43 #include "scalar.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class oneField Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class oneField
55 :
56  public one
57 {
58 public:
59 
60  // Public typedefs
61 
62  typedef oneField FieldType;
63 
64 
65  // Constructors
66 
67  //- Construct null
68  oneField() = default;
69 
70 
71  // Member Functions
72 
73  oneField field() const
74  {
75  return oneField();
76  }
77 
78 
79  // Member Operators
80 
81  one operator[](const label) const
82  {
83  return one();
84  }
85 };
86 
87 
88 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89 
90 } // End namespace Foam
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 #include "oneFieldI.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 #endif
99 
100 // ************************************************************************* //
Foam::one
A class representing the concept of 1 (one), which can be used to avoid manipulating objects that are...
Definition: one.H:60
Foam::oneField::operator[]
one operator[](const label) const
Definition: oneField.H:80
one.H
Foam::label
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:62
Foam::one::one
constexpr one() noexcept
Null constructible.
Definition: one.H:70
Foam::oneField::field
oneField field() const
Definition: oneField.H:72
oneFieldI.H
Foam::oneField::FieldType
oneField FieldType
Definition: oneField.H:61
scalar.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::oneField
A class representing the concept of a field of 1 used to avoid unnecessary manipulations for objects ...
Definition: oneField.H:53
Foam::oneField::oneField
oneField()=default
Construct null.