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 templated on size (order):
31 poly = logCoeff*log(x) + sum(coeff_[i]*x^i)
35 - integer powers, starting at zero
36 - evaluate(x) to evaluate the poly for a given value
37 - integrate(x1, x2) between two scalar values
38 - integrate() to return a new, intergated coeff polynomial
39 - increases the size (order)
40 - integrateMinus1() to return a new, integrated coeff polynomial where
41 the base poly starts at order -1
46 \*---------------------------------------------------------------------------*/
54 #include "VectorSpace.H"
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 // Forward declaration of classes
62 template<int PolySize>
65 // Forward declaration of friend functions
66 template<int PolySize>
70 const Polynomial<PolySize>&
74 /*---------------------------------------------------------------------------*\
75 Class Polynomial Declaration
76 \*---------------------------------------------------------------------------*/
78 template<int PolySize>
81 public VectorSpace<Polynomial<PolySize>, scalar, PolySize>
85 //- Include the log term? - only activated using integrateMinus1()
88 //- Log coefficient - only activated using integrateMinus1()
94 typedef Polynomial<PolySize> polyType;
96 typedef Polynomial<PolySize+1> intPolyType;
104 //- Construct from name and Istream
105 Polynomial(const word& name, Istream& is);
108 Polynomial(const Polynomial& poly);
115 //- Return access to the log term active flag
118 //- Return access to the log coefficient
124 //- Return polynomial value
125 scalar evaluate(const scalar x) const;
127 //- Return integrated polynomial coefficients
128 // argument becomes zeroth element (constant of integration)
129 intPolyType integrate(const scalar intConstant = 0.0);
131 //- Return integrated polynomial coefficients when lowest order
132 // is -1. Argument added to zeroth element
133 polyType integrateMinus1(const scalar intConstant = 0.0);
135 //- Integrate between two values
136 scalar integrateLimits(const scalar x1, const scalar x2) const;
140 friend Ostream& operator<< <PolySize>
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 } // End namespace Foam
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 # include "Polynomial.C"
156 # include "PolynomialIO.C"
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 // ************************************************************************* //