OneConstant2.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) 2020-2022 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::Function2s::OneConstant
26 
27 Description
28  Templated function of two variables that returns the corresponding 1 (one).
29 
30 Usage
31  \verbatim
32  <name> one;
33  \endverbatim
34 
35 SourceFiles
36  OneConstant.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef OneConstant2_H
41 #define OneConstant2_H
42 
43 #include "Function2.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 namespace Function2s
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class OneConstant Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class Type>
57 class OneConstant
58 :
59  public FieldFunction2<Type, OneConstant<Type>>
60 {
61 
62 public:
63 
64  // Runtime type information
65  TypeName("one");
66 
67 
68  // Constructors
69 
70  //- Construct from name
71  OneConstant(const word& name);
72 
73  //- Construct from name and dictionary
74  OneConstant(const word& name, const dictionary& dict);
75 
76 
77  //- Destructor
78  virtual ~OneConstant();
79 
80 
81  // Member Functions
82 
83  //- Return One
84  virtual inline Type value(const scalar x, const scalar y) const;
85 
86  //- Return One field
87  virtual inline tmp<Field<Type>> value
88  (
89  const scalarField& x,
90  const scalarField& y
91  ) const;
92 
93  //- Write in dictionary format
94  virtual void write(Ostream& os) const;
95 
96 
97  // Member Operators
98 
99  //- Disallow default bitwise assignment
100  void operator=(const OneConstant<Type>&) = delete;
101 };
102 
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 } // End namespace Function2s
107 } // End namespace Foam
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 #include "OneConstant2I.H"
112 
113 #ifdef NoRepository
114  #include "OneConstant2.C"
115 #endif
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 #endif
120 
121 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual void write(Ostream &os) const
Write in dictionary format.
Definition: OneConstant2.C:58
Templated function of two variables that returns the corresponding 1 (one).
Definition: OneConstant2.H:56
virtual ~OneConstant()
Destructor.
Definition: OneConstant2.C:51
void operator=(const OneConstant< Type > &)=delete
Disallow default bitwise assignment.
scalar y
A class for handling words, derived from string.
Definition: word.H:59
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
OneConstant(const word &name)
Construct from name.
Definition: OneConstant2.C:31
A class for managing temporary objects.
Definition: PtrList.H:53
virtual Type value(const scalar x, const scalar y) const
Return One.
Definition: OneConstant2I.H:32
Namespace for OpenFOAM.
const word & name() const
Return the name of the entry.
Definition: Function2.C:81