PolynomialEntry.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-2015 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::PolynomialEntry
26 
27 Description
28  PolynomialEntry container data entry for scalars. Items are stored in a
29  list of Tuple2's. Data is input in the form,
30  e.g. for an entry <entryName> that describes y = x^2 + 2x^3
31 
32  \verbatim
33  <entryName> polynomial [0 0 1 0 0] // optional dimensions
34  (
35  (1 2)
36  (2 3)
37  );
38  \endverbatim
39 
40 SourceFiles
41  PolynomialEntry.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef PolynomialEntry_H
46 #define PolynomialEntry_H
47 
48 #include "DataEntry.H"
49 #include "Tuple2.H"
50 #include "dimensionSet.H"
51 #include "DataEntryFwd.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward declaration of classes
59 
60 template<class Type>
61 class PolynomialEntry;
62 
63 // Forward declaration of friend functions
64 template<class Type>
66 
67 /*---------------------------------------------------------------------------*\
68  Class PolynomialEntry Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 template<class Type>
72 class PolynomialEntry
73 :
74  public DataEntry<Type>
75 {
76  // Private data
77 
78  //- PolynomialEntry coefficients - list of prefactor, exponent
80 
81  //- Flag to indicate whether poly can be integrated
82  bool canIntegrate_;
83 
84  //- The dimension set
86 
87 
88  // Private Member Functions
89 
90  //- Disallow default bitwise assignment
91  void operator=(const PolynomialEntry<Type>&);
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("polynomial");
98 
99 
100  // Constructors
101 
102  PolynomialEntry(const word& entryName, const dictionary& dict);
103 
104  //- Construct from components
106  (
107  const word& entryName,
108  const List<Tuple2<Type, Type> >&
109  );
110 
111  //- Copy constructor
112  PolynomialEntry(const PolynomialEntry& poly);
113 
114  //- Construct and return a clone
115  virtual tmp<DataEntry<Type> > clone() const
116  {
117  return tmp<DataEntry<Type> >(new PolynomialEntry(*this));
118  }
119 
120 
121  //- Destructor
122  virtual ~PolynomialEntry();
123 
124 
125  // Member Functions
126 
127  // Manipulation
128 
129  //- Convert time
130  virtual void convertTimeBase(const Time& t);
131 
132 
133  // Evaluation
134 
135  //- Return PolynomialEntry value
136  Type value(const scalar x) const;
137 
138  //- Integrate between two (scalar) values
139  Type integrate(const scalar x1, const scalar x2) const;
140 
141  //- Return dimensioned constant value
142  dimensioned<Type> dimValue(const scalar) const;
143 
144  //- Integrate between two values and return dimensioned type
146  (
147  const scalar x1,
148  const scalar x2
149  ) const;
150 
151 
152  // I/O
153 
154  //- Ostream Operator
155  friend Ostream& operator<< <Type>
156  (
157  Ostream& os,
158  const PolynomialEntry<Type>& cnst
159  );
160 
161  //- Write in dictionary format
162  virtual void writeData(Ostream& os) const;
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #ifdef NoRepository
173 # include "PolynomialEntry.C"
174 #endif
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::PolynomialEntry
PolynomialEntry container data entry for scalars. Items are stored in a list of Tuple2's....
Definition: PolynomialEntry.H:60
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::PolynomialEntry::canIntegrate_
bool canIntegrate_
Flag to indicate whether poly can be integrated.
Definition: PolynomialEntry.H:81
Foam::PolynomialEntry::PolynomialEntry
PolynomialEntry(const word &entryName, const dictionary &dict)
Definition: PolynomialEntry.C:32
Tuple2.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
PolynomialEntry.C
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:116
Foam::PolynomialEntry::integrate
Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values.
Definition: PolynomialEntry.C:175
Foam::PolynomialEntry::dimIntegrate
dimensioned< Type > dimIntegrate(const scalar x1, const scalar x2) const
Integrate between two values and return dimensioned type.
Definition: PolynomialEntry.C:223
Foam::PolynomialEntry::operator=
void operator=(const PolynomialEntry< Type > &)
Disallow default bitwise assignment.
Foam::PolynomialEntry::dimValue
dimensioned< Type > dimValue(const scalar) const
Return dimensioned constant value.
Definition: PolynomialEntry.C:213
DataEntry.H
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
dimensionSet.H
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::dimensioned< Type >
Foam::PolynomialEntry::dimensions_
dimensionSet dimensions_
The dimension set.
Definition: PolynomialEntry.H:84
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::PolynomialEntry::clone
virtual tmp< DataEntry< Type > > clone() const
Construct and return a clone.
Definition: PolynomialEntry.H:114
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
x
x
Definition: LISASMDCalcMethod2.H:52
DataEntryFwd.H
Foam::PolynomialEntry::~PolynomialEntry
virtual ~PolynomialEntry()
Destructor.
Definition: PolynomialEntry.C:135
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::PolynomialEntry::writeData
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition: PolynomialEntryIO.C:63
Foam::Tuple2
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:47
Foam::PolynomialEntry::convertTimeBase
virtual void convertTimeBase(const Time &t)
Convert time.
Definition: PolynomialEntry.C:142
Foam::PolynomialEntry::value
Type value(const scalar x) const
Return PolynomialEntry value.
Definition: PolynomialEntry.C:157
Foam::PolynomialEntry::TypeName
TypeName("polynomial")
Runtime type information.
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::PolynomialEntry::coeffs_
List< Tuple2< Type, Type > > coeffs_
PolynomialEntry coefficients - list of prefactor, exponent.
Definition: PolynomialEntry.H:78