FreeFOAM The Cross-Platform CFD Toolkit
polynomial.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) 2008-2010 OpenCFD Ltd.
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::polynomial
26 
27 Description
28  Polynomial container data entry for scalars. Items are stored in a list of
29  Tuple2's. Data is input in the form, e.g. for an entry <entryName> that
30  describes y = x^2 + 2x^3
31 
32  @verbatim
33  <entryName> polynomial
34  (
35  (1 2)
36  (2 3)
37  );
38  @endverbatim
39 
40 SourceFiles
41  polynomial.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef polynomial_H
46 #define polynomial_H
47 
49 #include <OpenFOAM/Tuple2.H>
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward declaration of classes
57 class polynomial;
58 
59 // Forward declaration of friend functions
60 Ostream& operator<<
61 (
62  Ostream&,
63  const polynomial&
64 );
65 
66 /*---------------------------------------------------------------------------*\
67  Class polynomial Declaration
68 \*---------------------------------------------------------------------------*/
69 
71 :
72  public DataEntry<scalar>
73 {
74  // Private data
75 
76  //- Polynomial coefficients - list of prefactor, exponent
78 
79 
80  // Private Member Functions
81 
82  //- Disallow default bitwise assignment
83  void operator=(const polynomial&);
84 
85 
86 public:
87 
88  //- Runtime type information
89  TypeName("polynomial");
90 
91 
92  // Constructors
93 
94  //- Construct from entry name and Istream
96 
97  //- Copy constructor
98  polynomial(const polynomial& poly);
99 
100 
101  //- Destructor
102  virtual ~polynomial();
103 
104 
105  // Member Functions
106 
107  //- Return polynomial value
108  scalar value(const scalar x) const;
109 
110  //- Integrate between two (scalar) values
111  scalar integrate(const scalar x1, const scalar x2) const;
112 
113 
114  //- Ostream Operator
115  friend Ostream& operator<<
116  (
117  Ostream&,
118  const polynomial&
119  );
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************ vim: set sw=4 sts=4 et: ************************ //