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 | Copyright (C) 2017 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::Function1Types::Uniform
26 
27 Description
28  Templated function that returns a constant value.
29 
30  Provides backward-compatibility for cases where a field is spatially
31  "uniform" and may be treated as a constant value.
32 
33  Usage - for entry <entryName> returning the value <value>:
34  \verbatim
35  <entryName> uniform <value>
36  \endverbatim
37 
38 SourceFiles
39  Uniform.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef Uniform_H
44 #define Uniform_H
45 
46 #include "Function1.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 namespace Function1Types
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class Uniform Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class Type>
60 class Uniform
61 :
62  public Constant<Type>
63 {
64  // Private Member Functions
65 
66  //- Disallow default bitwise assignment
67  void operator=(const Uniform<Type>&);
68 
69 
70 public:
71 
72  // Runtime type information
73  TypeName("uniform");
74 
75 
76  // Constructors
77 
78  //- Construct from entry name and dictionary
79  Uniform(const word& entryName, const dictionary& dict);
80 
81  //- Construct and return a clone
82  virtual tmp<Function1<Type>> clone() const
83  {
84  return tmp<Function1<Type>>(new Uniform<Type>(*this));
85  }
86 };
87 
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 } // End namespace Function1Types
92 } // End namespace Foam
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 #ifdef NoRepository
97  #include "Uniform.C"
98 #endif
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 #endif
103 
104 // ************************************************************************* //
virtual tmp< Function1< Type > > clone() const
Construct and return a clone.
Definition: Uniform.H:81
const word const dictionary & dict
Definition: Function1.H:88
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Templated function that returns a constant value.
Definition: Uniform.H:59
const word & entryName
Definition: Function1.H:88
A class for handling words, derived from string.
Definition: word.H:59
Templated function that returns a constant value.
Definition: Constant.H:56
Uniform(const word &entryName, const dictionary &dict)
Construct from entry name and dictionary.
Definition: Uniform.C:32
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.