CompatibilityConstant.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) 2011 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::CompatibilityConstant
26 
27 Description
28  Templated basic entry that holds a constant value for backwards
29  compatibility (when DataEntry type is not present)
30 
31  Usage - for entry <entryName> having the value <value>:
32  \verbatim
33  <entryName> <value>
34  \endverbatim
35 
36 SourceFiles
37  CompatibilityConstant.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef CompatibilityConstant_H
42 #define CompatibilityConstant_H
43 
44 #include "DataEntry.H"
45 #include "dimensionSet.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 template<class Type>
54 
55 template<class Type>
57 
58 /*---------------------------------------------------------------------------*\
59  Class CompatibilityConstant Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class Type>
64 :
65  public DataEntry<Type>
66 {
67  // Private data
68 
69  //- Constant value
70  Type value_;
71 
72  //- The dimension set
74 
75 
76  // Private Member Functions
77 
78  //- Disallow default bitwise assignment
80 
81 
82 public:
83 
84  // Runtime type information
85  TypeName("CompatibilityConstant");
86 
87 
88  // Constructors
89 
90  //- Construct from entry name and Istream
91  CompatibilityConstant(const word& entryName, const dictionary& dict);
92 
93  //- Copy constructor
95 
96  //- Construct and return a clone
97  virtual tmp<DataEntry<Type> > clone() const
98  {
99  return tmp<DataEntry<Type> >
100  (
101  new CompatibilityConstant<Type>(*this)
102  );
103  }
104 
105 
106  //- Destructor
107  virtual ~CompatibilityConstant();
108 
109 
110  // Member Functions
111 
112  //- Return constant value
113  Type value(const scalar) const;
114 
115  //- Integrate between two values
116  Type integrate(const scalar x1, const scalar x2) const;
117 
118  //- Return dimensioned constant value
119  dimensioned<Type> dimValue(const scalar) const;
120 
121  //- Integrate between two values and return dimensioned type
123  (
124  const scalar x1,
125  const scalar x2
126  ) const;
127 
128 
129  // I/O
130 
131  //- Ostream Operator
132  friend Ostream& operator<< <Type>
133  (
134  Ostream& os,
135  const CompatibilityConstant<Type>& cnst
136  );
137 
138  //- Write in dictionary format
139  virtual void writeData(Ostream& os) const;
140 };
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #ifdef NoRepository
150 # include "CompatibilityConstant.C"
151 #endif
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::CompatibilityConstant::integrate
Type integrate(const scalar x1, const scalar x2) const
Integrate between two values.
Definition: CompatibilityConstant.C:92
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::CompatibilityConstant::writeData
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition: CompatibilityConstantIO.C:63
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:116
Foam::CompatibilityConstant::operator=
void operator=(const CompatibilityConstant< Type > &)
Disallow default bitwise assignment.
Foam::CompatibilityConstant::~CompatibilityConstant
virtual ~CompatibilityConstant()
Destructor.
Definition: CompatibilityConstant.C:77
DataEntry.H
Foam::CompatibilityConstant::value_
Type value_
Constant value.
Definition: CompatibilityConstant.H:69
Foam::CompatibilityConstant::TypeName
TypeName("CompatibilityConstant")
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
dimensionSet.H
Foam::CompatibilityConstant
Templated basic entry that holds a constant value for backwards compatibility (when DataEntry type is...
Definition: CompatibilityConstant.H:52
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::CompatibilityConstant::clone
virtual tmp< DataEntry< Type > > clone() const
Construct and return a clone.
Definition: CompatibilityConstant.H:96
Foam::dimensioned< Type >
CompatibilityConstant.C
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::CompatibilityConstant::CompatibilityConstant
CompatibilityConstant(const word &entryName, const dictionary &dict)
Construct from entry name and Istream.
Definition: CompatibilityConstant.C:32
Foam::CompatibilityConstant::value
Type value(const scalar) const
Return constant value.
Definition: CompatibilityConstant.C:84
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::CompatibilityConstant::dimIntegrate
dimensioned< Type > dimIntegrate(const scalar x1, const scalar x2) const
Integrate between two values and return dimensioned type.
Definition: CompatibilityConstant.C:111
Foam::CompatibilityConstant::dimValue
dimensioned< Type > dimValue(const scalar) const
Return dimensioned constant value.
Definition: CompatibilityConstant.C:103
Foam::DataEntry
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: DataEntry.H:52
Foam::CompatibilityConstant::dimensions_
dimensionSet dimensions_
The dimension set.
Definition: CompatibilityConstant.H:72