1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Polynomial templated on size (order):
30 poly = logCoeff*log(x) + sum(coeff_[i]*x^i)
34 - integer powers, starting at zero
35 - evaluate(x) to evaluate the poly for a given value
36 - integrate(x1, x2) between two scalar values
37 - integrate() to return a new, intergated coeff polynomial
38 - increases the size (order)
39 - integrateMinus1() to return a new, integrated coeff polynomial where
40 the base poly starts at order -1
45 \*---------------------------------------------------------------------------*/
47 #ifndef PolynomialTemplate_H
48 #define PolynomialTemplate_H
53 #include "VectorSpace.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 // Forward declaration of classes
61 template<int PolySize>
64 // Forward declaration of friend functions
65 template<int PolySize>
69 const Polynomial<PolySize>&
73 /*---------------------------------------------------------------------------*\
74 Class Polynomial Declaration
75 \*---------------------------------------------------------------------------*/
77 template<int PolySize>
80 public VectorSpace<Polynomial<PolySize>, scalar, PolySize>
84 //- Include the log term? - only activated using integrateMinus1()
87 //- Log coefficient - only activated using integrateMinus1()
93 typedef Polynomial<PolySize> polyType;
95 typedef Polynomial<PolySize+1> intPolyType;
103 //- Construct from name and Istream
104 Polynomial(const word& name, Istream& is);
107 Polynomial(const Polynomial& poly);
114 //- Return access to the log term active flag
117 //- Return access to the log coefficient
123 //- Return polynomial value
124 scalar evaluate(const scalar x) const;
126 //- Return integrated polynomial coefficients
127 // argument becomes zeroth element (constant of integration)
128 intPolyType integrate(const scalar intConstant = 0.0);
130 //- Return integrated polynomial coefficients when lowest order
131 // is -1. Argument added to zeroth element
132 polyType integrateMinus1(const scalar intConstant = 0.0);
134 //- Integrate between two values
135 scalar integrateLimits(const scalar x1, const scalar x2) const;
139 friend Ostream& operator<< <PolySize>
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 } // End namespace Foam
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 # include "PolynomialTemplate.C"
155 # include "PolynomialTemplateIO.C"
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 // ************************************************************************* //