|
|
|
pdf.HGo 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) 1991-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::pdf 00027 00028 Description 00029 A library of runtime-selectable pdf's. 00030 00031 Returns a sampled value given the expectation (nu) and variance (sigma^2) 00032 00033 Sample of planned pdfs (beta p. 374-375): 00034 - binomial 00035 - geometric 00036 - Poisson 00037 - hypergeometric 00038 - Pascal 00039 - uniform 00040 - exponential 00041 - normal 00042 - Gamma 00043 - chi 00044 - t? 00045 - F? 00046 - beta 00047 - Weibull 00048 - Rayleigh 00049 - Cauchy? 00050 00051 The pdf is tabulated in equidistant nPoints, in an interval. 00052 These values are integrated to obtain the cumulated pdf, 00053 which is then used to change the distribution from unifrom to 00054 the actual pdf. 00055 00056 SourceFiles 00057 pdfI.H 00058 pdf.C 00059 pdfIO.C 00060 00061 \*---------------------------------------------------------------------------*/ 00062 00063 #ifndef pdf_H 00064 #define pdf_H 00065 00066 #include "IOdictionary.H" 00067 #include "autoPtr.H" 00068 #include "Random.H" 00069 00070 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00071 00072 namespace Foam 00073 { 00074 00075 /*---------------------------------------------------------------------------*\ 00076 Class pdf Declaration 00077 \*---------------------------------------------------------------------------*/ 00078 00079 class pdf 00080 { 00081 00082 protected: 00083 00084 // Protected data 00085 00086 const dictionary& dict_; 00087 00088 Random& rndGen_; 00089 00090 00091 public: 00092 00093 //-Runtime type information 00094 TypeName("pdf"); 00095 00096 00097 //- Declare runtime constructor selection table 00098 declareRunTimeSelectionTable 00099 ( 00100 autoPtr, 00101 pdf, 00102 dictionary, 00103 ( 00104 const dictionary& dict, 00105 Random& rndGen 00106 ), 00107 (dict, rndGen) 00108 ); 00109 00110 00111 // Constructors 00112 00113 //- Construct from dictionary 00114 pdf(const dictionary& dict, Random& rndGen); 00115 00116 00117 //- Selector 00118 static autoPtr<pdf> New(const dictionary& dict, Random& rndGen); 00119 00120 00121 //- Destructor 00122 virtual ~pdf(); 00123 00124 00125 // Member Functions 00126 00127 //- Sample the pdf 00128 virtual scalar sample() const = 0; 00129 00130 //- Return the minimum value 00131 virtual scalar minValue() const = 0; 00132 00133 //- Return the maximum value 00134 virtual scalar maxValue() const = 0; 00135 }; 00136 00137 00138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00139 00140 } // End namespace Foam 00141 00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00143 00144 #endif 00145 00146 // ************************************************************************* // |