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-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::oneField
29
30Description
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
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class oneField Declaration
52\*---------------------------------------------------------------------------*/
54class oneField
55:
56 public one
57{
58public:
59
60 // Public Typedefs
62 typedef oneField FieldType;
63
64
65 // Constructors
66
67 //- Default construct
68 oneField() noexcept = default;
69
70
71 // Member Functions
73 oneField field() const noexcept
74 {
75 return oneField{};
76 }
77
78
79 // Member Operators
81 one operator[](const label) const noexcept
82 {
83 return one{};
84 }
85};
86
87
88// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89
90} // End namespace Foam
91
92// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93
94// Global Operators
95
96#include "oneFieldI.H"
97
98// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99
100#endif
101
102// ************************************************************************* //
A class representing the concept of a field of 1 used to avoid unnecessary manipulations for objects ...
Definition: oneField.H:56
oneField field() const noexcept
Definition: oneField.H:72
oneField() noexcept=default
Default construct.
oneField FieldType
Definition: oneField.H:61
one operator[](const label) const noexcept
Definition: oneField.H:80
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:62
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223