1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Polynomial container data entry for scalars. Items are stored in a list of
30 Tuple2's. Data is input in the form, e.g. for an entry <entryName> that
31 describes y = x^2 + 2x^3
34 <entryName> polynomial
44 \*---------------------------------------------------------------------------*/
49 #include "DataEntry.H"
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 // Forward declaration of classes
60 // Forward declaration of friend functions
67 /*---------------------------------------------------------------------------*\
68 Class polynomial Declaration
69 \*---------------------------------------------------------------------------*/
73 public DataEntry<scalar>
77 //- Polynomial coefficients - list of prefactor, exponent
78 List<Tuple2<scalar, scalar> > coeffs_;
81 // Private Member Functions
83 //- Disallow default bitwise assignment
84 void operator=(const polynomial&);
89 //- Runtime type information
90 TypeName("polynomial");
95 //- Construct from entry name and Istream
96 polynomial(const word& entryName, Istream& is);
99 polynomial(const polynomial& poly);
103 virtual ~polynomial();
108 //- Return polynomial value
109 scalar value(const scalar x) const;
111 //- Integrate between two (scalar) values
112 scalar integrate(const scalar x1, const scalar x2) const;
116 friend Ostream& operator<<
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 } // End namespace Foam
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 // ************************************************************************* //