Loading...
Searching...
No Matches
Uniform.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) 2017 OpenFOAM Foundation
9 Copyright (C) 2020-2024 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::Function1Types::Uniform
29
30Description
31 Templated function that returns a constant value.
32
33 Provides backward-compatibility for cases where a field is spatially
34 "uniform" and may be treated as a constant value.
35
36 Usage - for entry <entryName> returning the value <value>:
37 \verbatim
38 <entryName> uniform <value>
39 \endverbatim
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef Foam_Function1Types_Uniform_H
44#define Foam_Function1Types_Uniform_H
45
46#include "Constant.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52namespace Function1Types
54
55/*---------------------------------------------------------------------------*\
56 Class Uniform Declaration
57\*---------------------------------------------------------------------------*/
58
59template<class Type>
60class Uniform
61:
62 public Constant<Type>
63{
64public:
65
66 //- Declare type-name, virtual type (with debug switch)
67 TypeName("uniform");
68
69
70 // Generated Methods
71
72 //- Default copy construct
73 Uniform(const Uniform<Type>&) = default;
74
75 //- No copy assignment
76 void operator=(const Uniform<Type>&) = delete;
77
78
79 // Constructors
80
81 //- Construct from entry name, dictionary and optional registry
83 (
84 const word& entryName,
85 const dictionary& dict,
86 const objectRegistry* obrPtr = nullptr
87 )
88 :
89 Constant<Type>(entryName, dict, obrPtr)
90 {}
91
92 //- Return a clone
93 virtual tmp<Function1<Type>> clone() const
94 {
95 return Function1<Type>::Clone(*this);
96 }
97};
98
99
100// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101
102} // End namespace Function1Types
103} // End namespace Foam
104
105// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106
107#endif
108
109// ************************************************************************* //
Constant(const word &entryName, const Type &value, const objectRegistry *obrPtr=nullptr)
Construct from components.
Definition Constant.C:28
virtual tmp< Function1< Type > > clone() const
Return a clone.
Definition Uniform.H:96
Uniform(const Uniform< Type > &)=default
Default copy construct.
Uniform(const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
Construct from entry name, dictionary and optional registry.
Definition Uniform.H:84
TypeName("uniform")
Declare type-name, virtual type (with debug switch).
void operator=(const Uniform< Type > &)=delete
No copy assignment.
static tmp< Function1< Type > > Clone(const Derived &fun)
Clone a Function1.
Definition Function1.H:190
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Registry of regIOobjects.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68