ZeroConstant.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) 2017-2020 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::Function1s::ZeroConstant
26 
27 Description
28  Templated function that returns the corresponding 0 (zero).
29 
30  Usage:
31  \verbatim
32  <name> zero;
33  \endverbatim
34 
35 SourceFiles
36  ZeroConstant.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef ZeroConstant_H
41 #define ZeroConstant_H
42 
43 #include "Function1.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 namespace Function1s
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class ZeroConstant Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class Type>
57 class ZeroConstant
58 :
59  public FieldFunction1<Type, ZeroConstant<Type>>
60 {
61 
62 public:
63 
64  // Runtime type information
65  TypeName("zero");
66 
67 
68  // Constructors
69 
70  //- Construct from name and dictionary
71  ZeroConstant(const word& name, const dictionary& dict);
72 
73 
74  //- Destructor
75  virtual ~ZeroConstant();
76 
77 
78  // Member Functions
79 
80  //- Return constant value
81  virtual inline Type value(const scalar) const;
82 
83  //- Integrate between two values
84  virtual inline Type integral(const scalar x1, const scalar x2) const;
85 
86  //- Write in dictionary format
87  virtual void write(Ostream& os) const;
88 
89 
90  // Member Operators
91 
92  //- Disallow default bitwise assignment
93  void operator=(const ZeroConstant<Type>&) = delete;
94 };
95 
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 } // End namespace Function1s
100 } // End namespace Foam
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 #include "ZeroConstantI.H"
105 
106 #ifdef NoRepository
107  #include "ZeroConstant.C"
108 #endif
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 #endif
113 
114 // ************************************************************************* //
const word const dictionary & dict
Definition: Function1.H:84
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
const word & name() const
Return the name of the entry.
void operator=(const ZeroConstant< Type > &)=delete
Disallow default bitwise assignment.
Templated function that returns the corresponding 0 (zero).
Definition: ZeroConstant.H:56
virtual ~ZeroConstant()
Destructor.
Definition: ZeroConstant.C:44
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
virtual Type value(const scalar) const
Return constant value.
Definition: ZeroConstantI.H:32
virtual void write(Ostream &os) const
Write in dictionary format.
Definition: ZeroConstant.C:51
virtual Type integral(const scalar x1, const scalar x2) const
Integrate between two values.
Definition: ZeroConstantI.H:42
ZeroConstant(const word &name, const dictionary &dict)
Construct from name and dictionary.
Definition: ZeroConstant.C:32
Namespace for OpenFOAM.