00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 2008-2010 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 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your 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, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::polynomial 00026 00027 Description 00028 Polynomial container data entry for scalars. Items are stored in a list of 00029 Tuple2's. Data is input in the form, e.g. for an entry <entryName> that 00030 describes y = x^2 + 2x^3 00031 00032 @verbatim 00033 <entryName> polynomial 00034 ( 00035 (1 2) 00036 (2 3) 00037 ); 00038 @endverbatim 00039 00040 SourceFiles 00041 polynomial.C 00042 00043 \*---------------------------------------------------------------------------*/ 00044 00045 #ifndef polynomial_H 00046 #define polynomial_H 00047 00048 #include <lagrangianIntermediate/DataEntry.H> 00049 #include <OpenFOAM/Tuple2.H> 00050 00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00052 00053 namespace Foam 00054 { 00055 00056 // Forward declaration of classes 00057 class polynomial; 00058 00059 // Forward declaration of friend functions 00060 Ostream& operator<< 00061 ( 00062 Ostream&, 00063 const polynomial& 00064 ); 00065 00066 /*---------------------------------------------------------------------------*\ 00067 Class polynomial Declaration 00068 \*---------------------------------------------------------------------------*/ 00069 00070 class polynomial 00071 : 00072 public DataEntry<scalar> 00073 { 00074 // Private data 00075 00076 //- Polynomial coefficients - list of prefactor, exponent 00077 List<Tuple2<scalar, scalar> > coeffs_; 00078 00079 00080 // Private Member Functions 00081 00082 //- Disallow default bitwise assignment 00083 void operator=(const polynomial&); 00084 00085 00086 public: 00087 00088 //- Runtime type information 00089 TypeName("polynomial"); 00090 00091 00092 // Constructors 00093 00094 //- Construct from entry name and Istream 00095 polynomial(const word& entryName, Istream& is); 00096 00097 //- Copy constructor 00098 polynomial(const polynomial& poly); 00099 00100 00101 //- Destructor 00102 virtual ~polynomial(); 00103 00104 00105 // Member Functions 00106 00107 //- Return polynomial value 00108 scalar value(const scalar x) const; 00109 00110 //- Integrate between two (scalar) values 00111 scalar integrate(const scalar x1, const scalar x2) const; 00112 00113 00114 //- Ostream Operator 00115 friend Ostream& operator<< 00116 ( 00117 Ostream&, 00118 const polynomial& 00119 ); 00120 }; 00121 00122 00123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00124 00125 } // End namespace Foam 00126 00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00128 00129 #endif 00130 00131 // ************************ vim: set sw=4 sts=4 et: ************************ //