OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

polynomial.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 2008-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::polynomial
00027 
00028 Description
00029     Polynomial container data entry for scalars. Items are stored in a list of
00030     Tuple2's. Data is input in the form, e.g. for an entry <entryName> that
00031     describes y = x^2 + 2x^3
00032 
00033     @verbatim
00034         <entryName>   polynomial
00035         (
00036             (1    2)
00037             (2    3)
00038         );
00039     @endverbatim
00040 
00041 SourceFiles
00042     polynomial.C
00043 
00044 \*---------------------------------------------------------------------------*/
00045 
00046 #ifndef polynomial_H
00047 #define polynomial_H
00048 
00049 #include "DataEntry.H"
00050 #include "Tuple2.H"
00051 
00052 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00053 
00054 namespace Foam
00055 {
00056 
00057 // Forward declaration of classes
00058 class polynomial;
00059 
00060 // Forward declaration of friend functions
00061 Ostream& operator<<
00062 (
00063     Ostream&,
00064     const polynomial&
00065 );
00066 
00067 /*---------------------------------------------------------------------------*\
00068                         Class polynomial Declaration
00069 \*---------------------------------------------------------------------------*/
00070 
00071 class polynomial
00072 :
00073     public DataEntry<scalar>
00074 {
00075     // Private data
00076 
00077         //- Polynomial coefficients - list of prefactor, exponent
00078         List<Tuple2<scalar, scalar> > coeffs_;
00079 
00080 
00081     // Private Member Functions
00082 
00083         //- Disallow default bitwise assignment
00084         void operator=(const polynomial&);
00085 
00086 
00087 public:
00088 
00089     //- Runtime type information
00090     TypeName("polynomial");
00091 
00092 
00093     // Constructors
00094 
00095         //- Construct from entry name and Istream
00096         polynomial(const word& entryName, Istream& is);
00097 
00098         //- Copy constructor
00099         polynomial(const polynomial& poly);
00100 
00101 
00102     //- Destructor
00103     virtual ~polynomial();
00104 
00105 
00106     // Member Functions
00107 
00108         //- Return polynomial value
00109         scalar value(const scalar x) const;
00110 
00111         //- Integrate between two (scalar) values
00112         scalar integrate(const scalar x1, const scalar x2) const;
00113 
00114 
00115     //- Ostream Operator
00116     friend Ostream& operator<<
00117     (
00118         Ostream&,
00119         const polynomial&
00120     );
00121 };
00122 
00123 
00124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00125 
00126 } // End namespace Foam
00127 
00128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00129 
00130 #endif
00131 
00132 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd