00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-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::pdf 00026 00027 Description 00028 A library of runtime-selectable PDF's. 00029 00030 Returns a sampled value given the expectation (nu) and variance (sigma^2) 00031 00032 Current PDF's include: 00033 - exponential 00034 - fixedValue 00035 - general 00036 - multi-normal 00037 - normal 00038 - Rosin-Rammler 00039 - uniform 00040 00041 The pdf is tabulated in equidistant nPoints, in an interval. 00042 These values are integrated to obtain the cumulated PDF, 00043 which is then used to change the distribution from unifrom to 00044 the actual pdf. 00045 00046 SourceFiles 00047 pdf.C 00048 pdfNew.C 00049 00050 \*---------------------------------------------------------------------------*/ 00051 00052 #ifndef pdf_H 00053 #define pdf_H 00054 00055 #include <OpenFOAM/IOdictionary.H> 00056 #include <OpenFOAM/autoPtr.H> 00057 #include <OpenFOAM/Random.H> 00058 00059 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00060 00061 namespace Foam 00062 { 00063 namespace pdfs 00064 { 00065 00066 /*---------------------------------------------------------------------------*\ 00067 Class pdf Declaration 00068 \*---------------------------------------------------------------------------*/ 00069 00070 class pdf 00071 { 00072 00073 protected: 00074 00075 // Protected data 00076 00077 //- Coefficients dictionary 00078 const dictionary pdfDict_; 00079 00080 //- Reference to the randmo number generator 00081 Random& rndGen_; 00082 00083 00084 // Protected Member Functions 00085 00086 //- Check that the PDF is valid 00087 virtual void check() const; 00088 00089 00090 public: 00091 00092 //-Runtime type information 00093 TypeName("pdf"); 00094 00095 00096 //- Declare runtime constructor selection table 00097 declareRunTimeSelectionTable 00098 ( 00099 autoPtr, 00100 pdf, 00101 dictionary, 00102 ( 00103 const dictionary& dict, 00104 Random& rndGen 00105 ), 00106 (dict, rndGen) 00107 ); 00108 00109 00110 // Constructors 00111 00112 //- Construct from dictionary 00113 pdf(const word& name, const dictionary& dict, Random& rndGen); 00114 00115 00116 //- Selector 00117 static autoPtr<pdf> New(const dictionary& dict, Random& rndGen); 00118 00119 00120 //- Destructor 00121 virtual ~pdf(); 00122 00123 00124 // Member Functions 00125 00126 //- Sample the pdf 00127 virtual scalar sample() const = 0; 00128 00129 //- Return the minimum value 00130 virtual scalar minValue() const = 0; 00131 00132 //- Return the maximum value 00133 virtual scalar maxValue() const = 0; 00134 }; 00135 00136 00137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00138 00139 } // End namespace pdfs 00140 } // End namespace Foam 00141 00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00143 00144 #endif 00145 00146 // ************************ vim: set sw=4 sts=4 et: ************************ //